Help, Session problems. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Help, Session problems. (/showthread.php?tid=9162) |
Help, Session problems. - El Forum - 06-15-2008 [eluser]benyu[/eluser] some session problems about obsession. config.php copy: Code: //codeigniter session. got problems: 1、Why each page has own record in sessions table? even i refresh the same page once it was added one record again? 2、Why session has saved ,but others page can't get it? in a function has used : $sess = array('uid'=>1,'name'=>'test'); $this->session->set_userdata($sess); redirect("/",'refresh'); and in the view page used; $this->session->userdata('uid');//it's empty! 3、the cookie vszone.net value not only contains session_id, but all other values. Help, Session problems. - El Forum - 06-19-2008 [eluser]Unknown[/eluser] For problem # 2, I had the similar thing happen for me. When I tried to add data to the session array by passing an array and then redirecting, none of them were stored. I am not sure but I think it has something to do with the redirect but I found that if I assigned one variable at a time that it then worked. Instead of: Code: $sess = array(’uid’=>1,’name’=>’test’); Possibly try: Code: $this->session->set_userdata(’uid’, 1); I don't know if this is the best way but it seemed to work for me. I had multiple variables so I looped through them with a foreach loop. Code: $sess = array(’uid’=>1,’name’=>’test’); Help, Session problems. - El Forum - 06-29-2008 [eluser]benyu[/eluser] Oh! Finally i found that reason of my problem was: $config['sess_cookie_name'] = 'vszone.net'; it contains the dot symboal! |