php中session_destroy()的作用?

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。那它做了什么?还有这个函数有什么用呢?

幕布斯7119047
浏览 1437回答 2
2回答

MM们

终结 Session如果您希望删除某些 session 数据,可以使用 unset() 或 session_destroy() 函数。unset() 函数用于释放指定的 session 变量:<?phpunset($_SESSION['views']);?>您也可以通过 session_destroy() 函数彻底终结 session:<?phpsession_destroy();?>注释:session_destroy() 将重置 session,您将失去所有已存储的 session 数据。
打开App,查看更多内容
随时随地看视频慕课网APP