setcookie with expire=0 does not expire after the browser closes

南楼画角 提交于 2020-07-18 18:58:28

问题


I use setcookie to make a cookie with expire=0. From the PHP document, (link)

The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the number ?of seconds before you want it to expire. Or you might use mktime(). time()+60*60*24*30 will set the cookie to expire in 30 days. If set to 0, or omitted, the cookie will expire at the end of the session (when the browser closes).

My php code:

setcookie('option', 'yes', 0, '/');

However, the cookie does still not expire (still can be accessed) when I close and re-open the browser(chrome but not firefox).

How do I make the cookie expires when the browser is closed?


回答1:


oh... this is because I activated "Continue where I left off" in chrome://chrome/settings/.

See here



来源:https://stackoverflow.com/questions/17124044/setcookie-with-expire-0-does-not-expire-after-the-browser-closes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!