最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php session_destroy()和session_unset()区别
时间:2022-11-14 23:01:27 编辑:袖梨 来源:一聚教程网
session_unset()
You should know that on recent PHP only the first one of these functions works correctly. And if you use the other two, var_dump will print you the result you expected (session cleaned up), but the session file on the server won't be cleaned up. So use the first one.
代码如下 | 复制代码 |
function session_clean1($logout=false) foreach($v as $x) function session_clean2($logout=false) function session_clean3($logout=false) ?> |
On previous php (
释放当前在内存中已经创建的所有$_SESSION变量,但不删除session文件以及不释放对应的session id
session_destroy()
删除当前用户对应的session文件以及释放session id,内存中的$_SESSION变量内容依然保留
因此,释放用户的session所有资源,需要顺序执行如下代码:
PHP代码
代码如下 | 复制代码 |
// Initialize the session. // Unset all of the session variables. // If it's desired to kill the session, also delete the session cookie. // Finally, destroy the session. |
相关文章
- 消逝的光芒困兽砍杀者指套怎么获得 砍杀者指套获得方法 10-17
- 消逝的光芒困兽佣兵射击护手怎么获得 佣兵射击护手获得方法 10-17
- 消逝的光芒困兽佣兵战斗裤怎么获得 佣兵战斗裤获取方法 10-17
- 霍格沃茨之遗兑换码是什么 霍格沃茨之遗最新2025兑换码 10-17
- 鸣潮仇远培养材料有哪些-仇远天赋突破材料汇总 10-17
- 辉烬锡蒙利技能是什么 锡蒙利技能介绍一览 10-17