本文介绍了多个具有相同名称的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现我在使用其中一个页面时在IE中遇到了问题。
我设置cookie:

I just figured out that I have a problem in IE while working with one of my pages.I set cookie with:

setcookie('page', '12345', '2000000', '/');

如果我登录,我会重新调用再次调用该函数的cookie。
在firefox中一切正常,因为旧cookie被删除但在IE中两个cookie都保留了吗?
这怎么可能发生?这不是非法的吗?

And if I login I reset the cookie calling that function again.In firefox everything works fine cause the old cookie is deleted but in IE both cookies stay?How can this happen? Isn't that illegal?

现在我修正了:

setcookie('page', '', time() - 3600, '/');
setcookie('page', '1234', '2000000', '/');

这是可行的解决方案还是我错过了什么?

Is this ok solution or am I missing something?

推荐答案

,即正确的删除cookie的方法。

According to the documentation, that is the correct way to remove a cookie.

这篇关于多个具有相同名称的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-27 04:53
查看更多