Modify session cookie expiry and session timeout for a CakePHP session

后端 未结 2 991
一个人的身影
一个人的身影 2020-12-18 05:51

I\'m struggling to accomplish the following: Alter the user\'s session cookie expiry date based on the user\'s type.

I have a CakePHP web application wherein I have

相关标签:
2条回答
  • 2020-12-18 06:03

    Go in app/config/core.php

    In this file search for,

    Configure::write('Session.timeout', '120');
    

    Session time out time (in seconds), by default it is 120 seconds. You can edit it here as required. Now the actual timeout duration depends on,

    Configure::write('Security.level', 'medium');
    
    if 'high' then Session timeout in 'Session.timeout' x 10, 
    if 'medium' then Session timeout in 'Session.timeout' x 100, 
    if 'low'    Session timeout in 'Session.timeout' x 300
    

    So by combination of Session.timeout and Security.level you can get the desired session timeout

    0 讨论(0)
  • 2020-12-18 06:22

    Find this: app/config/core.php

    Change this line to your desired value in minutes:
    Configure::write('Session.timeout', '120');

    (Since CakePHP 2.3.0 Security.level is no longer used.
    Changelog: http://cakephp.org/changelogs/2.3.0)

    0 讨论(0)
提交回复
热议问题