Codeigniter increase session time out not working

后端 未结 2 1500
Happy的楠姐
Happy的楠姐 2021-01-07 13:30

I am new to codeigniter framework. I have a problem with session time out with pages. Right now I had enabled with the ip match ,user agent matching but doesn\'t work.

2条回答
  •  梦毁少年i
    2021-01-07 14:22

    Finally i found the solution for the problem.

    The following ways to increase or decrease the session time out. 1.

      ini_set('session.gc_maxlifetime', 60);
    
      config->config.php
    
      $config['sess_expiration'] = ''; //in seconds.
    

    2.

     $config['sess_time_to_update'] = '' ;//in seconds (as same in sess_expiration seconds)
    

    3.If you are checking in login controller and all controller for the session data as

    $_SESSION['data'] == 'your login id or role or something
    

    .this is not getting session expired the session datas.but we need to check the check with $this->session-> userdata('your id or data need to check') and before once login successfull then need to assign the value to the session as $this->session->set_userdata('your id or something');

    while checking the session = $this->session->userdata() is empty or zero need to session_destory() and then need to redirect to your home page. Another way to increase :

    1. If your site was running in apache2 and only one website means we can directly mention the session_gc_maxtime.

    These two ways i had tried and i found the solution for the session time out.its working fine for me.

    Thanks to all.

提交回复
热议问题