I need to get all sessions data and take some actions upon them, is there any possible way to get them, I found how to solve it in php but codeigniter use's it own custom sessions library.
Native php
$_SESSION
How can I do it in codeigniter
I need to get all sessions data and take some actions upon them, is there any possible way to get them, I found how to solve it in php but codeigniter use's it own custom sessions library.
Native php
$_SESSION
How can I do it in codeigniter
You can use db session. So data will be stored to the database. See Saving Session Data to a Database
If you have no database support just use cookie and get the data with
To get all session data you can use
$this->session->all_userdata();
To print all your session variable use this line anywhere in your code :
If you want to see everything the way I've done it is to cast
$this->session
as array thenprint_r
it.Hope this helps.
If you know how to do this in PHP why not implement that, and not use the codeigniter session class? my experience is that the CI session class breaks pretty badly with ajax calls and proxy servers, so it is best avoided.
To get all users session data.First we need to initialize the Session class manually in our controller constructor use following code.
Then we use following code.
Above function return an associative array like the following.
For complete Ci Session tutorial. Please referrer following link