【问题标题】:Cakephp Session expiration doesn't work?Cakephp 会话过期不起作用?
【发布时间】:2014-06-12 21:37:00
【问题描述】:

我对 Cakephp 很陌生。我希望我的会话数据在 3 天内过期。但是,好像过期时间只有几个小时,因为用户登录后,他/他将在几个小时后退出。

这是我在 core.php 中所做的所有更改:

我添加了超时参数:

Configure::write('Session', array(
        'defaults' => 'php',
        'timeout' => 4320   
    ));

我检查了大部分相关问题,但没有一个解决方案适合我:

将 'timeout' 更改为 'session.timeout',将 4320 更改为 '4320' 和......

提前感谢您的帮助。 :)

【问题讨论】:

  • 好吧,只是基于它保持用户登录的时间。几个小时后(不确定多少小时),它会注销用户,因为缓存已过期。我会将引擎更改为 File 以查看是否是问题所在。 BTW,有什么方法可以查看缓存的过期时间吗?
  • I checked most of the relevant questions
  • 好像我把缓存和 sessoin 混在一起了。对于那个很抱歉。我刚刚更新了我的问题。在我的代码中登录与缓存无关。都是使用 session 实现的。
  • AD7six:我会增加 gc_maxlifetime 看看会发生什么。谢谢大家的帮助。 :)

标签: session cakephp timeout


【解决方案1】:

您可以使用以下代码:

Configure::write('Session', array(
    'defaults' => 'php',
    'timeout' => 30, // The session will timeout after 30 minutes of inactivity
    'cookieTimeout' => 1440, // The session cookie will live for at most 24 hours, this does not effect session timeouts
    'checkAgent' => false,
    'autoRegenerate' => true, // causes the session expiration time to reset on each page load
));

阅读更多here

【讨论】:

    猜你喜欢
    • 2013-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-20
    • 1970-01-01
    • 2011-10-17
    • 1970-01-01
    相关资源
    最近更新 更多