我的Codeigniter会话一创建就自动过期

时间:2019-07-27 00:17:30

标签: codeigniter session codeigniter-3 session-cookies

我的 codeigniter 登录会话出现问题,会话一经创建即自动过期,因此它会重定向回登录页面 不管登录信息是否真实。该会话会立即被自动销毁。这是我的配置页面。

//date_default_timezone_set("Europe/Istanbul");  

 $config['sess_driver'] = 'files'; 

 $config['sess_cookie_name'] = 'cisession';  

 $config['sess_expiration'] = 86400;  

//$config['sess_save_path'] = 'ci_sessions';

 $config['sess_save_path'] = APPPATH . 'ci_sessions/'; 

 $config['sess_match_ip'] = FALSE;

 $config['sess_time_to_update'] = 300;

 $config['sess_regenerate_destroy'] = FALSE;

 $config['sess_expire_on_close'] = FALSE;

 $config['sess_encrypt_cookie']  = FALSE;

 $config['sess_use_database']    = FALSE;

 $config['sess_match_useragent'] = FALSE;

 $config['cookie_prefix']   = '';

 $config['cookie_domain']   = str_replace("http://","",str_replace("https://","", $config['base_url']));

$config['cookie_path']      = '/';

$config['cookie_secure']    = FALSE;

//$config['cookie_httponly']    = FALSE;

1 个答案:

答案 0 :(得分:0)

请在配置文件中使用这些配置进行会话。

  $config['sess_driver'] = 'files';
  $config['sess_cookie_name'] = 'ci_session';
  $config['sess_expiration'] = 0;
  $config['sess_save_path'] = sys_get_temp_dir();
  $config['sess_match_ip'] = FALSE;
  $config['sess_time_to_update'] = 600;
  $config['sess_regenerate_destroy'] = FALSE;