codeigniter session为什么gen auto?

时间:2015-06-23 16:55:43

标签: php codeigniter session

结果$ member form db 我设置了

$sess['session_id']=$rs['user_id'];
$sess['session_name']=$rs['user_username'];
$this->session->set_userdata($sess);

我的收到

$this->session->userdata('session_id') = 1
$this->session->userdata('user_username') = admin

但是有一刻我看到了

$this->session->userdata('session_id') = 700336412dd230af450558b92a728b59  

错了

$this->session->userdata('user_username') = admin

为什么session_id(num)会自动更改?

这是我的配置config.php

$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'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

1 个答案:

答案 0 :(得分:0)

如果要更改会话数据,请使用:

$this->session->set_userdata('session_name', $session_value);

如果您想要使用会话:

$session_value = $this->session->userdata('session_name');

更多详情,请阅读userguide

也不要使用变量名称,如:session_id