I restarted apache,but the session doesn't expire!
Destroying a PHP Session A PHP session can be destroyed by session_destroy() function. This function does not need any argument and a single call can destroy all the session variables. If you want to destroy a single session variable then you can use unset() function to unset a session variable.
Removing a specific value from a session is as simple as using the function unset(), just as you would for any other variable.
Description ¶ session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start() has to be called.
Delete all files in the temporary directory defined in php.ini.
Why not use session_destroy()
to destroy the client's session?
If you have:
session.save_handler = files
in your php.ini file, which I believe you will by default, then session data will be stored in files. Therefore bouncing the server won't destroy them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With