InterviewSolution
| 1. |
How to handle sessions in Codeigniter? |
|
Answer» How to add values in session in Codeigniter $_SESSION['username'] = 'bestinterviewquestion.com' // It can be use in core PHP We can pass array to store values in session in Codeigniter. $array = array( $this->session->set_userdata($array); How to remove values in session in Codeigniterunset($_SESSION['username']); // It can be use in core PHP If we WANT to remove more values from session then we can use like this $this->session->unset_userdata($array); // $array is DEFINED above. It is an array with KEY & values. How to get data from session in Codeigniter$this->session->userdata('username'); // Here we will get username, if it is exists in session. |
|