问题
I have set Configure::write('Security.level', 'medium');
to low, set Configure::write('Session.timeout', '120');
to higher numbers, and in cake/libs/security.php
I have set the inactiveMins()
function to the following,
function inactiveMins() {
switch (Configure::read('Security.level')) {
case 'high':
return 10;
break;
case 'medium':
return 100;
break;
case 'low':
default:
return 550;
break;
}
}
But sessions are still expiring at around 120 minutes. This is a time tracking app so I would like to have the functionality of leaving the app running in the background until needed. But the session closes too soon. Is there another way to leave the session open for hours at a time since these options aren't working?
From APP/CONFIG/CORE.PHP ***
/**
* Session time out time (in minutes).
* Actual value depends on 'Security.level' setting.
*/
Configure::write('Session.timeout', '120');
Core version 1.3.4
回答1:
This is the standard setting:
/**
* Session time out time (in seconds).
* Actual value depends on 'Security.level' setting.
*/
Configure::write('Session.timeout', '120');
I always change it to something like:
Configure::write('Session.timeout', 120 * 60);
回答2:
php.ini file was overriding cake settings. Changed Configure::write('Session.save', 'php');
to Configure::write('Session.save', 'cake');
in app/config/core.php
来源:https://stackoverflow.com/questions/8331379/cakephp-session-expiring-too-soon