How to increase the login time for cakephp 2

扶醉桌前 提交于 2020-01-17 13:57:22

问题


Can you please let me know how to increase the session expiry time for CakePHP 2?

Currently, i set the configuration as bellow.

Configure::write('Session', array(
        'defaults' => 'php',
                'timeout' => 129600, // The session will timeout after 30 minutes of inactivity
                'cookieTimeout' => 129600, // The session cookie will live for at most 24 hours, this does not effect session timeouts
                'ini' => array(
                   'session.gc_maxlifetime' => 129600 // 36 hours
                 )
    ));

But, these settings not work and session expired in almost 24 minutes.Thanks This thread didn't solve my problem "How to increase cakephp Auth component session expire time"


回答1:


Add this configuration in core.php file of your application

Configure::write('Session', array(
'defaults' => 'cache',//default session
'timeout'  => '<time_in_minute>',//in minutes
'cookieTimeout' => '<time_in_minute>',//in minutes
'ini' => array('session.cookie_domain' => env('HTTP_BASE')),
'handler' => array(
    'config' => '<handler>' //if you are using default sessions then this field is not necessary
 )
));

Add time according to your requirement



来源:https://stackoverflow.com/questions/43583718/how-to-increase-the-login-time-for-cakephp-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!