会话未在codeigniter中设置

时间:2013-04-10 05:22:53

标签: codeigniter codeigniter-2 codeigniter-url

我已按此设置会话

$loc_details = array(
                   'maincity_id'  =>$maincity_id,
                   'mainzoneid'     => $mainzoneid,
                   'mainproductid'     => $productid,
               );
        $this->session->set_userdata($loc_details);

我在这里检索了像这样的值

$maincity_id=$this->session->userdata('maincity_id');

    //$mainzone_id=$this->session->userdata('mainzone_id');
        $mainproduct_id=$this->session->userdata('mainproductid');

但如果我看到输出会话没有设置可以任何人帮助这个

1 个答案:

答案 0 :(得分:1)

你需要这样做..........

$loc_details = array(
               'maincity_id'  =>$maincity_id,
               'mainzoneid'     => $mainzoneid,
               'mainproductid'     => $productid,
           );

 $this->session->set_userdata('loc_details',$loc_details);

 $loc_details = $this->session->userdata("loc_details");

 $maincity_id = $loc_details['maincity_id'];

 $mainproduct_id = $loc_details['mainproductid'];