Basic CI class session usage

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.