我在php中通过这个调用设置了一个cookie
setcookie('alert_msg', 'you have the add badge');
我试过这样解开它
setcookie('alert_msg', '');
setcookie('alert_msg', false);
setcookie('alert_msg', false, 1);
setcookie('alert_msg', false, time()-3600);
setcookie('alert_msg', '', 1, '/');
并且它仍然不会取消$_COOKIE [‘alert_msg’]中的cookie值.
我试过Firefox和Chrome
代码示例:
if (isset($_COOKIE['alert_msg'])) {
$this->set('alert_msg', $_COOKIE['alert_msg']);
unset($_COOKIE['alert_msg']);
setcookie('alert_msg', '', 1, '/');
}