![]() |
Session Destroy and Flashdata - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Session Destroy and Flashdata (/showthread.php?tid=80435) |
Session Destroy and Flashdata - donpwinston - 10-30-2021 When I execute a Code: $session->destroy(); The flash data is not available on the redirected page. Why? RE: Session Destroy and Flashdata - InsiteFX - 10-31-2021 Because you desroyed the session you need to recreate the session again first. RE: Session Destroy and Flashdata - donpwinston - 10-31-2021 (10-31-2021, 01:16 AM)InsiteFX Wrote: Because you desroyed the session you need to recreate the session again first. OK, I get it. It's not created again until the constructor of the redirected page is executed. RE: Session Destroy and Flashdata - manager - 10-31-2021 (10-31-2021, 12:51 PM)donpwinston Wrote:You must start the session BEFORE setFlashdata, not from your redirected page, because at this time there is no session.(10-31-2021, 01:16 AM)InsiteFX Wrote: Because you desroyed the session you need to recreate the session again first. just add session_start() right after destroying it (and before setFlashdata()) |