我正面临使用 OrangeHRM 构建的自动注销问题Symfony 1.2.4
我试过什么?
我试图通过
php.ini
和.htaccess
在评论以下文件代码后尝试
/symfony/lib/vendor/symfony/lib/user/sfBasicSecurityUser.class.php
public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array()) { // initialize parent parent::initialize($dispatcher, $storage, $options); if (!array_key_exists('timeout', $this->options)) { $this->options['timeout'] = 86400; //$this->options['timeout'] = 1800; } $this->options['timeout'] = 86400; //$this->options['timeout'] = 2 * 24 * 60 * 60; // force the max lifetime for session garbage collector to be greater than timeout /*if (ini_get('session.gc_maxlifetime') < $this->options['timeout']) { ini_set('session.gc_maxlifetime', $this->options['timeout']); }*/ ini_set('session.gc_maxlifetime', $this->options['timeout']); // read data from storage $this->authenticated = $storage->read(self::AUTH_NAMESPACE); $this->credentials = $storage->read(self::CREDENTIAL_NAMESPACE); $this->lastRequest = $storage->read(self::LAST_REQUEST_NAMESPACE); if (null === $this->authenticated) { $this->authenticated = false; $this->credentials = array(); } else { // Automatic logout logged in user if no request within timeout parameter seconds $timeout = $this->options['timeout']; if (false !== $timeout && null !== $this->lastRequest && time() - $this->lastRequest >= $timeout) { if ($this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Automatic user logout due to timeout'))); } $this->setTimedOut(); $this->setAuthenticated(false); } } $this->lastRequest = time();
}
尝试
$_SESSION['symfony/user/sfUser/lastRequest']
手动设置。试图通过发送获取请求来保持活动状态
AJAX
。试图从
YML
位于的设置文件中增加会话时间.../symfony/apps/orangehrm/config/factories.yml
all: routing: class: sfPatternRouting param: generate_shortest_url: true extra_parameters_as_query_string: true storage: class: sfSessionStorage param: session_name: PHPSESSID session_cache_limiter: nocache user: class: myUser param: timeout: 86000 logging: %SF_LOGGING_ENABLED% use_flash: true default_culture: %SF_DEFAULT_CULTURE%
最终结果
以上所有技术都失败了。