1

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?

4

2 に答える 2

1

Safari でも同じ問題が発生しました (Cookie の設定を解除できませんでした)。パスの設定を解決する必要があります

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

これがうまくいくことを願っています;)

于 2012-07-24T08:18:29.637 に答える
0

クライアント側でそれらを単にクリアすることは、これをテストする適切な方法ではありません..サーバー側のCookieを実際に「設定解除」してみましたか?

于 2012-07-20T21:05:18.920 に答える