开发者

how to remove cookie in firefox?

i have created a cookie with:

$domain = ($_SERVER['HTTP_HOST'] != 'lo开发者_StackOverflowcalhost') ? $_SERVER['HTTP_HOST'] : false;
setcookie('cookiename', 'data', time()+60*60*24*365, '/', $domain, false);

but how do i delete it?

i tried with just switching the + to - but it didnt work.

$domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;
setcookie('cookiename', 'data', time()-60*60*24*365, '/', $domain, false);


setcookie('fayer', FALSE, 1);

And make sure to use the same paramaters that you used while creating the cookie. If you had restricted the cookie to a domain, you must mention that while deleting the cookie too.

The browser deletes the cookie only when the parameters match.

For example, if you created the cookie like this:

setcookie('fayer', "some value", time()+24600, "/", "www.fayer.com", 0);

you must delete the cookie this way:

setcookie('fayer', FALSE, 1, "/", "www.fayer.com", 0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜