从PHP,我无法让浏览器删除一个cookie。追下去的问题,我创建了一个简单的测试页面,只是没有这样的:为什么我不能删除这个cookie?
// Set cookie named MrPants with value foo to expire at end of session
setcookie("MrPants", "foo", 0);
加载该页面后,我看到在我的Firefox饼干菜单饼干。到现在为止还挺好。
然后我跟着example #2 here删除一个cookie:
// Set that cookie's expires time in the past
setcookie("MrPants", "", time() - 3600);
,没有任何效果。我也尝试过指定路径;不用找了。
在Firebug中,我看到的响应头以下:
Set-Cookie ZDEDebuggerPresent=php,phtml,php3; path=/
MrPants=deleted; expires=Tue, 25-Aug-2009 15:27:46 GMT; path=/some/path
缺少什么我在这里?
尝试使用远远超过的cookie。就像'mktime(1,1,1,1,1,1,1980)'的时间一样...... – ircmaxell 2010-08-25 15:37:55