Reputation: 1
I have written the following code.
class Users extends CI_Controller{
public function login(){
$this->load->library('session');
$users=array(
'name'=>'john',
'nickname'=>'walker',
'human'=>true,
);
var_dump($this->session->set_userdata($users));
}
}
The var_dump
is giving me NULL
. What am I doing wrong?
Upvotes: 0
Views: 48
Reputation: 94642
You are var_dump'ing the result of a set_userdata()
and not the session data. Try this
class Users extends CI_Controller{
public function login(){
$this->load->library('session');
$users=array(
'name'=>'john',
'nickname'=>'walker',
'human'=>true,
);
$this->session->set_userdata($users);
print_r($this->session->all_userdata());
}
}
Upvotes: 3