Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Getting all data stored in session

How can I get all variables stored in sesson?



3.5k
Accepted
answer

Hi,

There is a code which you can use:

for ($i=0; $i<5; $i++) {
    $this->session->set('var'.$i, $i);
}
foreach ($this->session->getIterator() as $key => $value) {
    var_dump($key);
    var_dump($value);
}


12.1k

Thanks, I hope to see session->get(null) method to get an array of all stored data in future realses.