Home > php教程 > php手册 > session_unset()和session_destroy()用法分析

session_unset()和session_destroy()用法分析

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:18:53
Original
1443 people have browsed it

 

关于session_unset()和session_destroy()的函数使用进行介绍。

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

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

if (session_destroy())
        {
            ShowMsg("注销成功!",'/member/login');
            exit();
        }
        else
        {
            unset($_SESSION);
            ShowMsg("注销成功!",'/member/login');
            exit();
        }


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

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
Latest Issues
Session
From 1970-01-01 08:00:00
0
0
0
session
From 1970-01-01 08:00:00
0
0
0
session login information
From 1970-01-01 08:00:00
0
0
0
session problem
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template