Session proper config? |
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.
No SEO spam
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)
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/li...ssion-data
(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/libra...ssion-data Can someone please update the document. Thanks in advanced.
No SEO spam
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |