Laravel Auth Logout()+ Session Flush()没有注销用户

时间:2014-11-29 08:41:12

标签: php session laravel-4

我一直无法成功退出我的申请约3个月。

注销路线上的控制器代码:

Auth::logout();
Session::flush();

对于它的值,mem表列在users表中不为null,而session配置驱动器是file。

编辑:

我注意到在注销后数据库中的记忆标记值正在被更改,同时表现出保持登录的行为。

2 个答案:

答案 0 :(得分:2)

尝试使用

public function getLogout() {
    Auth::logout();
    // Session::flush();
    return Redirect::to('login')->with('message', 'Your are now logged out!');
}

注销并重定向到您的登录屏幕

并使用

public function __construct() {
    $this->beforeFilter(function(){
        if (!Auth::check())
            return Redirect::to('admin/login')->with('message', 'You need to be logged in!');
    });
}

在您的控制器中限制用户不登录登录

答案 1 :(得分:-2)

本着解决问题和继续前进的精神,这就是创可贴的作用:

    //standard logout method
    Auth::logout();

    sleep(1);

    //finally logged out!!!!
    Auth::logout();
相关问题