Access array variable in session (CodeIgniter)
问题 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['item']'); but it doesn't work. What's wrong with my syntax here? I've print_r'd my session and the items are in the config array. I've also tried: echo $this->session->userdata("config['item']"); I get no errors this time, but no data either. 回答1: If config is an array . And item is string name of what you want to get from config then echo $this-