Laravel会话取消设置不工作


Laravel Session Unset Not working

我使用Session::put('user', $user_details); 创建了一个会话

所以我需要在注销时取消设置,我尝试了

1 . Session::flush();
2 . Session::forget('user', $user_details);

但两者都不起作用。知道吗?

它很简单:

session()->forget('user'); // using the global helper
// or
'Session::forget('user'); // using the facade

忘记一把钥匙。要刷新整个会话,它是:

session()->flush(); // using the global helper
// or
'Session::flush(); // using the facade