php code:
setcookie('loginid',$loginid);
setcookie('islogin',1);像上面一样,我设置cookie时没有设置生命周期,我想在关掉网页后cookie自动清除掉,该怎么做?
setcookie('loginid',$loginid);
setcookie('islogin',1);像上面一样,我设置cookie时没有设置生命周期,我想在关掉网页后cookie自动清除掉,该怎么做?
不过你需要注意的是“关闭浏览器”而不是“关闭选项卡”
但一定要注意是关闭浏览器,而不是是“选项卡”,我在测试IE8的时候需要把所有的浏览器都关掉cookie才会失效。php帮助文档原文:
bool setcookie ( string $name [, string $value [, int $expire = 0 ]...]] )
...
$expire :
If set to 0, or omitted, the cookie will expire at the end of the session (when the browser closes).