Session proper config? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: Session proper config? (/showthread.php?tid=64608) |
Session proper config? - solidcodes - 03-11-2016 autoload.php Code: $autoload['libraries'] = array( config.php Code: $config['encryption_key'] = 'Xasdf32zsdfj0e98ehBDS3xS9j3DAIHKwdfweHfdksj34Ifreaky0120302weakyshitPSYCHOP4324342ath'; controller Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); view Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); But when I run these codes nothing, the session data is not displayed. What am I missing here? Thanks in advance. RE: Session proper config? - keulu - 03-11-2016 it's because you don't affect key to your session array. In your case, you can access to your vars like that. PHP Code: $username = $this->session->username; if you want to get your complete array, set your session with a key PHP Code: $newdata = array( you can check if a key is available with PHP Code: $this->session->has_userdata('newdata'); // (false in your case) RE: Session proper config? - salain - 03-11-2016 You only need to change how you retrieve the session data from: PHP Code: $data2 = $this->session->userdata('newdata'); PHP Code: $data2 = $this->session->userdata(); As per the manual http://www.codeigniter.com/user_guide/libraries/sessions.html#retrieving-session-data RE: Session proper config? - solidcodes - 03-11-2016 (03-11-2016, 06:35 AM)keulu Wrote: it's because you don't affect key to your session array. thanks dude very helpful. The document is very confusing. https://codeigniter.com/user_guide/libraries/sessions.html#adding-session-data Can someone please update the document. Thanks in advanced. RE: Session proper config? - InsiteFX - 03-30-2016 PHP Code: $config['sess_save_path'] = APPPATH.'tmp' I use one of the above to store my session files, I prefer using the APPPATH one. |