从浏览器中删除Cookie? [英] Delete cookie from browser?

查看:112
本文介绍了从浏览器中删除Cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法指示网络浏览器完全删除使用PHP设置的Cookie?

Is there any way of instructing a web browser to completely delete one's cookie set with PHP?

我不想< > expiry 它或等待浏览器被关闭。

I do not want to expiry it or wait for the browser to be closed.

删除我的意思是实际上没有列在

With delete I mean to actually not have it listed inside the cookie's list anymore.

推荐答案

您无法强制浏览器删除与任何Cookie相关联的文件,因为您不能保证实际上这样的文件 - 浏览器和Web服务器之间关于Cookie的合同是数据将在合格请求中显示。

You cannot force the browser to delete the file associated with any cookie, because you can't guarantee there's actually such a file - the contract between browser and web server regarding cookies is that the data will be presented at eligible requests.

您声明您不想等待cookie过期,但cookie过期是指示不再需要数据的正确方法,并且不应该在未来的请求中呈现,这在大多数情况下确实转换为浏览器移除文件。

You state that you "don't want to wait for the cookie to expire", but cookie expiration is the correct method for indicating that the data is no longer needed and should not be presented on future requests, which in most cases does translate to the browser removing the file.

因此,要删除Cookie,请将其过期时间设置为过期时间。在PHP中,这是通过 setcookie()

To delete a cookie, therefore, set its expiration time into the past. In PHP, this is done with setcookie().

这篇关于从浏览器中删除Cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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