First modify the configuration file (config.php)
//生成一个随机不重复的字符串走位加密的key保存到config.php的encryption_key中 $config['encryption_key']='bf363d0a';
Load SESSION class
$this->load->library('session');
Create SESSION
$array = array('id'=>1,'name'=>'niu'); $this->session->set_userdata($array);
View SESSION
$this->session->userdata(session名);
Delete SESSION
$this->session->unset_userdata('SESSION名');
First modify the configuration file (config.php)
//生成一个随机不重复的字符串走位加密的key保存到config.php的encryption_key中 $config['encryption_key']='bf363d0a';
Load the SESSION class
$this->load->library('session');
Create SESSION
$array = array('id'=>1,'name'=>'niu'); $this->session->set_userdata($array);
View SESSION
$this->session->userdata(session名);
Delete SESSION
$this->session->unset_userdata('SESSION名');
For more articles related to the basic usage of CI classes to implement sessions, please pay attention to the PHP Chinese website!