CodeIgniter Forums
$session set-bug? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: $session set-bug? (/thread-66651.html)



$session set-bug? - startbbs - 11-15-2016

PHP Code:
$session->set($newdata); 
when I use this function, the session data only is available for the next request, then the data was automatically cleared , it is same as $session->setFlashdata('item', 'value'); 
it that a bug? 

How can I save the session data into cookie? then encrypt cookie data.


RE: $session set-bug? - ridho - 11-15-2016

It's working for me. Are you forgot to add this line?

PHP Code:
$session->start(); 



RE: $session set-bug? - startbbs - 11-15-2016

(11-15-2016, 08:40 PM)ridho Wrote: It's working for me. Are you forgot to add this line?

PHP Code:
$session->start(); 
Thanks, I forget!!! it works well now. 
I am using the file to save session data, Can I save it to cookie via encrypt?

Now, the session was saved as file in my hosting. how long will the session be cleaned? 
frankly I don't like to save the data in webhosing. because the reading speed is slow than from cookie.


RE: $session set-bug? - ridho - 11-15-2016

Yes you can, but for what? I think, this is a bad idea for storing session data to cookie although it's encrypted.

Soon, if you use $session->destroy();

If you don't like files for storing sessions, You can use database for storing sessions.


RE: $session set-bug? - startbbs - 11-15-2016

(11-15-2016, 09:06 PM)ridho Wrote: Yes you can, but for what? I think, this is a bad idea for storing session data to cookie although it's encrypted.

Soon, if you use $session->destroy();

If you don't like files for storing sessions, You can use database for storing sessions.
Thanks, it works well now.