Welcome Guest, Not a member yet? Register   Sign In
$session->destroy() throws exception
#6

Oh, I got your problem!
It is your miscoding.
You cannot destroy uninitialized session.
PHP causes an error (Warning), and CI4 make all errors into Exceptions.

If you want to destroy Session, you must start the session.
PHP Code:
        $session = \Config\Services::session();
        $session->destroy();

        $session->start();
        $session->destroy(); 
Reply


Messages In This Thread
$session->destroy() throws exception - by joho - 04-11-2024, 01:44 AM
RE: $session->destroy() throws exception - by kenjis - 04-11-2024, 11:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB