为了账号安全,请及时绑定邮箱和手机立即绑定

php中session_destroy()的作用?

php中session_destroy()的作用?

幕布斯7119047 2019-02-05 10:06:17
session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start() has to be called. 它会destroys all of the data associated with the current session,但是它既不注销变量,又不注销session cookie。那它做了什么?还有这个函数有什么用呢?
查看完整描述

2 回答

?
MM们

TA贡献1886条经验 获得超2个赞

终结 Session
如果您希望删除某些 session 数据,可以使用 unset() 或 session_destroy() 函数。

unset() 函数用于释放指定的 session 变量:

<?php
unset($_SESSION['views']);
?>
您也可以通过 session_destroy() 函数彻底终结 session:

<?php
session_destroy();
?>
注释:session_destroy() 将重置 session,您将失去所有已存储的 session 数据。



查看完整回答
反对 回复 2019-03-16
  • 2 回答
  • 0 关注
  • 1542 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号