PHP session_destroy() function is used to destroy all the data associated with the current session. This function removes all the session variables stored in the session. The session_destroy() function can be used to log a user out of an application.
Example 1: This code destroys the current session and unsets all the variables associated with it.
session_start();
session_destroy();
Example 2: This code destroys the session and redirects the user to the login page.
The PHP Session destroy function is part of the PHP core library. No external packages or libraries are required to use this function.
PHP Session::Destroy - 7 examples found. These are the top rated real world PHP examples of Session::Destroy from package huge extracted from open source projects. You can rate examples to help us improve the quality of examples.