First, modify the configuration file (config. php) {code ...} load SESSION class {code ...} create SESSION {code ...} view SESSION {code ...} delete SESSION {code ...} first, modify the configuration file (config. php)
// Generate a random, non-repeated string location encryption key and save it to the encryption_key in config. php. $ config ['encryption _ key'] = 'bf363d0a ';
Load SESSION class
$this->load->library('session');
Create a SESSION
$array = array('id'=>1,'name'=>'niu');$this->session->set_userdata($array);
View Sessions
$ This-> session-> userdata (session name );
Delete SESSION
$ This-> session-> unset_userdata ('session name ');
First, modify the configuration file (config. php)
// Generate a random, non-repeated string location encryption key and save it to the encryption_key in config. php. $ config ['encryption _ key'] = 'bf363d0a ';
Load SESSION class
$this->load->library('session');
Create a SESSION
$array = array('id'=>1,'name'=>'niu');$this->session->set_userdata($array);
View Sessions
$ This-> session-> userdata (session name );
Delete SESSION
$ This-> session-> unset_userdata ('session name ');
For more articles about how to use the CI class to implement the basic session usage, refer to the PHP Chinese network!