简体   繁体   中英

Session expires very quickly in cakePHP 2.9

I tried many options in config.php file but no success. Here the options. first one:

 Configure::write('Session', array(
    'defaults' => 'php',
            'timeout' => 31556926, // The session will timeout after 30 minutes of inactivity
            'cookieTimeout' => 31556926,
            'ini' => array(
               'session.gc_maxlifetime' => 31556926 // 36 hours
             )
));

second one:

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

Please let me know, as session expires in middle of work!

use the following code in your (app/Config/core.php)

 Configure::write('Session', array(
        'defaults' => 'cake',
        '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
    ));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM