Home > Backend Development > PHP Tutorial > Analysis of the difference between session_unset and session_destroy in php_PHP tutorial

Analysis of the difference between session_unset and session_destroy in php_PHP tutorial

WBOY
Release: 2016-07-21 15:28:02
Original
815 people have browsed it

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 current user corresponding session file and release the session
id, the content of the $_SESSION variable in the memory is still retained

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

Copy code The code is as follows:

$_SESSION['user'] = 'lowell';
session_unset();
session_destroy();
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323685.htmlTechArticlesession_unset() releases all $_SESSION variables currently created in memory, but does not delete the session file and does not release The corresponding session id session_destroy() deletes the corresponding session id of the current user...
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