为什么会这样?这是怎么回事?
在注销用户之前,我将值放入会话变量中。在此之后,我使用哨兵的注销功能:Sentry::logout();
但是注销后,我的会话变量中的值仍然有效。为什么?
这是我的代码:
Session::put('test', 1);
// Log the user out
Sentry::logout();
echo(Session::get('test'));
exit;
我在输出中得到了1
,但我什么都不期待......我以为Sentry::logout()
函数会破坏所有会话数据?这真的很令人困惑。
编辑:
知道了!哨兵配置中的 cookie 名称必须与 在配置/会话中定义.php来自拉拉维尔!
尝试使用:
// when logging out you can use:
Auth::logout(); // or
Sentry::logout(); // (or both if you are logged in with both methods )
// if you want to Remove All Items From The Session use the following function:
Session::flush();