问题
Hi guys my session is not working on CodeIgniter, please help.. Following is my config
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
I am setting like as follows
$this->session->set_userdata('test', "Hello world!");
And trying to retrieve as follows and it prints empty
$this->session->userdata('test')
Printing all the session
var_dump($this->session->all_userdata());
prints
array(1) {
["session_id"]=>
string(32) "968esdf9539d0bdc29faeb48ad86948"}
I have gone through https://forum.codeigniter.com/post-325982.html
回答1:
This is an issue with CodeIgniter itself
Replace the system
folder with the latest version of codeIgniter and it started working, replace with version 3.1.0
. I was using 3.0
来源:https://stackoverflow.com/questions/48973842/session-not-working-on-codeigniter