Access array variable in session (CodeIgniter)

后端 未结 3 1403
攒了一身酷
攒了一身酷 2021-02-08 08:14

I have an array called config. I\'m trying to echo a variable from the array in the session.

I\'ve tried:

echo $this->session->userdata(\'config[\         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-08 08:51

    Always escape your string it should be this way:

    echo $this->session->userdata('config[\'item\']'); 
    

提交回复
热议问题