【问题标题】:CodeIgniter sess_destroy() for current session当前会话的 CodeIgniter sess_destroy()
【发布时间】:2011-08-07 20:08:34
【问题描述】:

我在 Session.php 中有这段代码:

// Is the session current?
if (($session['last_activity'] + $this->sess_expiration) < $this->now)
{   
    $this->sess_destroy();
    return FALSE;
}

对于每个会话,CodeIgniter 将 cookie 的过期日期设置为 $this-&gt;sess_expiration + time();

如果我设置this-&gt;sess_expiration = 5,并在 6 秒后发送 get 请求,它将不包含 cookie,因为浏览器会由于过期日期而破坏它。那么CI只会创建新的会话记录,删除旧的解决方案是什么?

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    您需要清理数据库中的会话表,该表用于存储会话信息。此表应命名为ci_sessions

    【讨论】:

    • 你的意思是每次使用'last_activity'删除旧记录?
    • 您可以在配置文件中更改会话设置。并在config.php中设置$config['sess_expiration']
    猜你喜欢
    • 1970-01-01
    • 2020-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-04
    • 2012-03-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多