Codeigniter modifying session data

前端 未结 3 871
天命终不由人
天命终不由人 2021-01-19 05:28

I store few data in session as the following:

$session_data = array(\"uid\" => \"test user\", \"loged_in\" => true);

$this->session->set_userdat         


        
3条回答
  •  别那么骄傲
    2021-01-19 06:03

    Aside from all your typos (of course those matter in programming), you might want to see if you are just confusing yourself and typo'ing the array/value/key name incorrectly:

    Do the following:

    echo "
    ";
    print_r($this->session->all_userdata());
    echo "
    ";

    and after doing that you will be one step closer to knowing what typo's or problems you ran into as that will display your session array:

    Array
    (
        [session_id] => 4a5a5dca22728fb0a84364eeb405b601
        [ip_address] => 127.0.0.1
        [user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7;
        [last_activity] => 1303142623
        [uid]        => 2
        etc...
    )
    

提交回复
热议问题