cannot set an index of a session |
Hello. I try to change an index of a session but codeigniter sent an Error :
PHP Code: $this->session->user['coins'] = 5; Code: Indirect modification of overloaded property CI_Session::$user has no effect But I didn't send any Error with following code: PHP Code: $_SESSION['user']['coins'] = 5; Is there any solution?
You need to read the CodeIgniter User's Guide
PHP Code: $this->session->set_userdata('coins', '5'); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-04-2018, 06:36 AM)hamidb80 Wrote:(07-04-2018, 03:44 AM)InsiteFX Wrote: You need to read the CodeIgniter User's Guide https://www.codeigniter.com/user_guide/l...ssion-data
(07-04-2018, 01:31 AM)hamidb80 Wrote: Hello. I try to change an index of a session but codeigniter sent an Error : I think what you were trying to do is PHP Code: $this->session->user = ['coins' => 5]; Which produces the exact same result as PHP Code: $_SESSION['user']['coins'] = 5; After either of the above is run PHP Code: var_dump($_SESSION); Code: array (size=2) |
Welcome Guest, Not a member yet? Register Sign In |