【问题标题】:sentry - after logout the session value is still alivesentry - 注销后会话值仍然存在
【发布时间】:2015-04-02 16:56:46
【问题描述】:

为什么会这样? 这里有什么问题?

我在注销用户之前将值放入会话变量中。 在此之后,我使用哨兵的注销功能:Sentry::logout(); 但是注销后,我的会话变量中的值仍然存在..为什么?

这是我的代码:

    Session::put('test', 1);
    // Log the user out
    Sentry::logout();
    echo(Session::get('test'));
    exit;

我在输出中得到了1,但我什么都不期待... 我认为Sentry::logout() 函数会破坏所有会话数据? 这真是令人困惑..

编辑:

我明白了! sentry 配置中的 cookie 名称必须与 在 laravel 的 config/session.php 中定义!

【问题讨论】:

    标签: php laravel session cartalyst-sentry


    【解决方案1】:

    尝试使用:

    // 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();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-21
      • 1970-01-01
      • 1970-01-01
      • 2021-10-17
      • 1970-01-01
      • 2011-06-26
      • 1970-01-01
      相关资源
      最近更新 更多