如何在codeigniter中保持用户登录会话而不自动注销

时间:2014-05-14 05:57:15

标签: php codeigniter session

我想保持用户登录,不允许自动登录

这是配置文件代码:

$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 720000;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'ospos_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

如何更改此配置文件,以便在没有自动登录的情况下保持用户登录

1 个答案:

答案 0 :(得分:1)

将您的代码更改为$config['sess_expiration']=0;

新守则:

$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = PHP_INT_MAX;