php中session_unset与session_destroy的区别分析_php技巧

WBOY
Release: 2016-05-17 09:18:32
Original
1138 people have browsed it

session_unset()
释放当前在内存中已经创建的所有$_SESSION变量,但不删除session文件以及不释放对应的session
id

session_destroy()
删除当前用户对应的session文件以及释放session
id,内存中的$_SESSION变量内容依然保留

因此,释放用户的session所有资源,需要顺序执行如下代码:

复制代码 代码如下:

$_SESSION['user'] = 'lowell';
session_unset();
session_destroy();
?>
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!