在浏览 PHP 中的各种用户注销函数时,我总是会遇到用于特定用途的 session_destory()
远程 session 变量,但它们不使用 setCookie()
删除用户的 PHP SESSIONID
PHP 文档明确指出:
In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie() may be used for that.
我尝试在Firefox中跟踪cookie,并使用session_destroy()
,继续保留PHP SESSIONID
的cookie,下次用户登录时,相同SESSIONID
使用的 ID。
在用户注销后,从用户的计算机远程远程 session id Cookie 不是总是安全的吗?如果我无法删除 SessionID Cookie,会发生什么情况?
最佳答案
只需这样做:
$_SESSION = array();
这样 session 就是空的。
不需要(也不增加安全性)像你尝试的那样销毁它。
关于php - 注销后删除用户的 session 存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12783944/