I\'m trying to learn PHP and using sessions. I seen examples about using session_destroy on logout, but I see this in the php documentation:
In order
I've never actually deleted the session ID from the session. I usually just unset the necessary variables from the session (so if, for instance, you set a logged in user as $_SESSION['user'] = $userModel;
then I just unset($_SESSION['user']);
). To remove the cookie from the user's browser (like the documentation says) do this:
setcookie(session_id(), "", time() - 3600);
Read Example #1
from the session_destroy() documentation for more info.