RE: How to unset session variable in codeigniter?

How to unset session variable in codeigniter?

Bikash Team Leader Asked on February 12, 2017 in CODEIGNITER.
Add Comment
2 Answers

Get session data:

 $this->session->userdata('USERID');
 

To add custom session data:

$session_data = array('USERID' =>"11",'USERNAME' =>"AVIANCE",'PASSWORD' =>"12345");
 $this->session->set_userdata($session_data); // $session_data is an associative array of a USER information

To remove all session data:

 $this->session->unset_userdata('USERID'); // Removing values from session
 
Senior Developer Answered on February 12, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.