php - Access Session data in codeigniter -
$username = $this->input->post('username'); $password = $this->input->post('password'); $result = $this->accountmodel->login($username,$password); if($result){ foreach($result $row){ $loggedin = array('admin_name' => $row['username'], 'is_loggedin' => true); $this->session->set_userdata($loggedin);
how able access ['admin_name']
, ['is_loggedin']
without having run code , running foreach loop $this->session->all_userdata()
from "retrieving session data" section of session class docs:
any piece of information session array available using following function:
$this->session->userdata('item');
so want:
$this->session->userdata('admin_name');
the docs friend ;)
Comments
Post a Comment