Session::put() 数据在 Laravel PHP 中使用数据库会话驱动程序存储在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21718968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:01:06  来源:igfitidea点击:

Where is Session::put() data stored using database session driver in Laravel PHP?

phpdatabasesessionlaravel

提问by Brandon Romano

I'm currently using the database session driverto store my sessions in Laravel.

我目前正在使用数据库会话驱动程序将我的会话存储在 Laravel 中。

I understand that the user sessions are stored in the database, but does the data from a Session::put get stored?

我知道用户会话存储在数据库中,但是来自 Session::put 的数据是否被存储?

For example:

例如:

Session::put('userID', $user->id);

Where is the data about the userID being stored?

关于用户 ID 的数据存储在哪里?

回答by alexrussell

Under default settings your sessions are stored in a table called 'sessions' in your default database connection.

在默认设置下,您的会话存储在默认数据库连接中名为“会话”的表中。

Each session will have a payload which contains all sorts of data, but your userID will be in the payload for your session's row somewhere.

每个会话都有一个包含各种数据的有效负载,但您的用户 ID 将位于会话所在行的有效负载中。