cakephp 3 如何增加会话超时

cakephp 3 how to increase session timeout

有谁知道如何增加 cakephp 3 中的会话超时,无论我如何尝试,它只是在 15 分钟时超时,

最近的事情,我试过了

在 app.php 文件中更改此设置,但它仍然会在 15 分钟左右超时,这非常令人沮丧

'Session' => [
        'defaults' => 'php',
            'timeout'=>300*60//in minutes
    ],

谢谢

存在会话超时,存在会话 cookie 生存期。后者不受前者的影响,前者可在 CakePHP 配置中配置,如您的代码片段所示,并由 CakePHP 的会话处理程序处理。

检查您的 PHP 安装 session.cookie_lifetime 设置,这可能是问题的原因。如果您需要更改它,请在 php.ini 中进行更改,或者使用 CakePHP 会话配置中的 ini 选项。

引自文档:

By default PHP sets the session cookie to expire as soon as the browser is closed, regardless of the configured Session.timeout value. The cookie timeout is controlled by the session.cookie_lifetime ini value and can be configured using:

Configure::write('Session', [
    'defaults' => 'php',
    'ini' => [
        // Invalidate the cookie after 30 minutes without visiting
        // any page on the site.
        'session.cookie_lifetime' => 1800
    ]
]);

The difference between Session.timeout and the session.cookie_lifetime value is that the latter relies on the client telling the truth about the cookie. If you require stricter timeout checking, without relying on what the client reports, you should use Session.timeout.

Cookbook > Sessions > Session Configuration

如果这不能解决问题,那么您必须进行一些调试,检查会话 cookie 过期值,连接到 CakePHPs 会话处理程序以确定会话是否在此处正在被杀死(\Cake\Network\Session::_timedOut()),等等...