Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php OrangeHRM自动注销问题_Php_Orangehrm_Symfony 1.2 - Fatal编程技术网

Php OrangeHRM自动注销问题

Php OrangeHRM自动注销问题,php,orangehrm,symfony-1.2,Php,Orangehrm,Symfony 1.2,使用Symfony 1.2.4 我试过什么? 我试图通过php.ini和和

使用
Symfony 1.2.4

我试过什么?

  • 我试图通过
    php.ini
    为会话分配最大时间

  • 在注释文件
    /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();
    
  • 最终结果


    以上所有技术都失败了。

    首先,您不应该接触供应商目录中的文件


    修改symfony应用程序中会话生存期的正确方法是通过config.yml文件

    首先,不要触摸供应商目录中的文件


    修改symfony应用程序中会话生存期的正确方法是通过config.yml文件

    尽管这有点晚,但这将帮助您延长会话超时值。此设置位于
    ../symfony/apps/orangehrm/config/factories.yml
    文件中

    您将看到下面的设置

    all:
      routing:
        class: ohrmPatternRouting
        param:
          generate_shortest_url:            true
          extra_parameters_as_query_string: true
      storage:
        class: sfSessionStorage
        param:
          session_name: PHPSESSID
          session_cookie_secure: true
          session_cache_limiter: nocache
      user:
         class: myUser
         param:
           timeout:         1800 #change this value to change the session timeout interval
           logging:         %SF_LOGGING_ENABLED%
           use_flash:       true
           default_culture: %SF_DEFAULT_CULTURE%
    

    您应该更改的相关值是
    timeout
    参数。默认值为1800秒(30分钟)。如果您在开发环境中,请执行symfony clear cache命令(在终端中,进入
    symfony
    文件夹并执行
    /symfony cc
    )以使其工作。希望这有帮助

    尽管这有点晚,但这将帮助您延长会话超时值。此设置位于
    ../symfony/apps/orangehrm/config/factories.yml
    文件中

    您将看到下面的设置

    all:
      routing:
        class: ohrmPatternRouting
        param:
          generate_shortest_url:            true
          extra_parameters_as_query_string: true
      storage:
        class: sfSessionStorage
        param:
          session_name: PHPSESSID
          session_cookie_secure: true
          session_cache_limiter: nocache
      user:
         class: myUser
         param:
           timeout:         1800 #change this value to change the session timeout interval
           logging:         %SF_LOGGING_ENABLED%
           use_flash:       true
           default_culture: %SF_DEFAULT_CULTURE%
    

    您应该更改的相关值是
    timeout
    参数。默认值为1800秒(30分钟)。如果您在开发环境中,请执行symfony clear cache命令(在终端中,进入
    symfony
    文件夹并执行
    /symfony cc
    )以使其工作。希望这有帮助

    您好,谢谢您的回复。我已经尝试了您提供的解决方案,但仍然面临问题。我的symfony版本是
    1.2.4
    Hello,感谢您的回复。我已经尝试了您提供的解决方案,但仍然面临问题。我的symfony版本是
    1.2.4
    感谢您的回复。我已经试过了,但是失败了。请再次查看我的更新答案。谢谢回复。我已经试过了,但是失败了。请再次查看我的更新答案。