session_destroy(): Trying to destroy uninitialized session |
Hi this is my logout function:
Code: 122 public function logout() The session is inizialized because in my template i print session()->get('admin_email') and i see it...
What do you mean? What is your issue?
Even if you destroy the session, the session variables ($_SESSION) still exists in the request. Also Quote:You do not have to call this method from usual code. Cleanup session data rather than destroying the session.
"Trying to destroy uninitialized session"
You tried to destroy uninitialized session, so you need to initialize the session before calling the session_destroy().
(07-30-2023, 10:30 PM)kenjis Wrote: "Trying to destroy uninitialized session" The session are inizialized , the admin is logged and i see the session()->get('admin_email') before click on logout
When did you see the session()->get('admin_email') ?
If you saw it in the page before clicking the logout link, yes, you actually initialized the session in the request. But did you initialize the session in the request for logout? If you really initialize the session, the error never occurs. Or PHP goes crazy. |
Welcome Guest, Not a member yet? Register Sign In |