关闭浏览器后,带有expire = 0的setcookie不会过期 [英] setcookie with expire=0 does not expire after the browser closes
问题描述
我使用setcookie制作一个带有expire = 0的cookie。从PHP文档中,
(链接)
I use setcookie to make a cookie with expire=0. From the PHP document, (link)
cookie过期的时间。这是Unix时间戳,以秒为单位。换句话说,您很可能会使用time()函数加上希望过期的秒数来进行设置。或者您可以使用mktime()。 time()+ 60 * 60 * 24 * 30将cookie设置为在30天后过期。 如果设置为0或省略,则cookie将在会话结束时(浏览器关闭时)过期。
我的php代码:
setcookie('option', 'yes', 0, '/');
但是,当我关闭并重新打开时,cookie仍然没有过期(仍然可以访问)
However, the cookie does still not expire (still can be accessed) when I close and re-open the browser(chrome but not firefox).
如何在关闭浏览器后使cookie过期?
How do I make the cookie expires when the browser is closed?
推荐答案
哦...这是因为我在chrome:// chrome / settings /中激活了继续我离开的地方。
oh... this is because I activated "Continue where I left off" in chrome://chrome/settings/.
请参见此处
这篇关于关闭浏览器后,带有expire = 0的setcookie不会过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!