safari cookie问题 [英] safari cookie issue

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

问题描述

我把头发拉出来。它适用于chrome和Firefox,但不能在safari。我做错了什么?



我设置了一个临时cookie,然后检查它是否设置。当我清除safari中的所有cookie,然后我运行这个文件,它认为cookie仍然存在。



这里是代码

  setcookie(testcookie,'cookiesetting temporary'); 
if(isset($ _ COOKIE ['testcookie'])){
echocookie set:
} else {
echono cookie set;
}

在safari中,禁用Cookie并删除所有Cookie后,运行上面的代码,它仍然回显cookie设置。



为了确保,我还查看了资源下的safari中的开发工具,我没有看到cookie。 / p>

我在这里缺少什么?

解决方案

使用Safari(无法取消设置Cookie)。
您应该解决设置路径

  setcookie('testcookie','cookiesetting temporary',time ,'/ path /'); // set 
setcookie('testcookie','',time() - 3600,'/ path /'); // delete

希望这项工作;)


I am pulling my hair out on this. It works on chrome and Firefox but not in safari. What am I doing wrong?

I am setting up a temp cookie and then check if it is set or not. When I clear all the cookies from safari, and then I run this file, it thinks that cookie is still there.

here is the code

setcookie("testcookie", 'cookiesetting temporary');
if(isset($_COOKIE['testcookie'])){
    echo "cookie set":
}else{
    echo "no cookie set";
}

In safari only, after disabling the cookies and removing all the cookies , when I run the code above, it still echoes cookie set.

Just to make sure, I also looked in the dev tools in safari under resources and I see no cookie there.

What am I missing here?

解决方案

I had the same problem with Safari (couldn't unset a cookie). You should solve setting the path

setcookie('testcookie', 'cookiesetting temporary', time()+3600, '/path/'); // set 
setcookie('testcookie', '', time()-3600, '/path/'); // delete

Hope this works ;)

这篇关于safari cookie问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆