session_unset() and session_destroy() usage analysis_PHP tutorial

WBOY
Release: 2016-07-20 11:02:45
Original
833 people have browsed it

Introducing the use of session_unset() and session_destroy() functions.

session_unset()
Release all $_SESSION variables currently created in memory, but do not delete the session file and do not release the corresponding session
id

session_destroy()
Delete the session file corresponding to the current user and release the session
id, the contents of the $_SESSION variable in memory are still retained

if (session_destroy())
           {
ShowMsg("Logout successful!",'/member/login');
exit();
}
        else
           {
              unset($_SESSION);
ShowMsg("Logout successful!",'/member/login');
exit();
}


Therefore, to release all resources of the user's session, the following code needs to be executed in sequence:
Program code

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!