0

大家好,你认为为什么会这样?

$veri = array("uye_kadi" => $this->input->post('kadi'), 'oturum' => TRUE);
$this->session->set_userdata($veri);
4

1 回答 1

1

首先确保您已包含会话库

来自自动加载配置文件:

    $autoload['libraries'] = array('session');

或来自控制器:

    $this->load->library('session');

然后将您的代码替换为:

 $veri = array("uye_kadi" => $this->input->post('kadi'), 'oturum' => TRUE);
 $this->session->set_userdata('sess_var_name',$veri);

 echo $this->session->userdata('sess_var_name');

数组 with 可以用作:

 $ar = array('user_id'=>900,
        'username'=>'John Doe');

 $this->session->set_userdata('user_details',$ar);

 $this->session->userdata('user_details','user_id'); //Return 900;  

希望它会有所帮助!

于 2013-01-25T12:55:08.033 回答