Home >Backend Development >PHP Tutorial >window.onunload中如何清除cookie

window.onunload中如何清除cookie

WBOY
WBOYOriginal
2016-06-23 14:13:33938browse

我现在想在window.onunload方法中清除cookie,但是具体的清除方法怎么写,我是现在.php文件中的,代码如下
<script> <br /> window.onunload=function(){ <br /> //在这里清楚cookie <br /> } <br /> </script>
为何我在这里获取cookie也取不到,取的方法如下$_COOKIE["CODEIMG"],请大神指点下,本人菜鸟


回复讨论(解决方案)

 既然你用的是js实现 肯定$_COOKIE取不到, js里面操作都是用 document.cookie = ""; 这样操作的
你直接把cookie 设置为过期 就可以清除了

Statement:
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
Previous article:ThinkPHP小白 POST无效Next article:Apache重写问题