douyanpeng0748
2013-03-05 12:16
浏览 231
已采纳

删除cookie不起作用

hello i`m running crazy through a problem that i tried to fetch.

i can not delete a cookie that will be set on index.php like that:

$a = 'text';
setcookie('name_of_cookie', $a, time()+60*60*24*365);

on page-php i can call that cookie and the content is like $a. i tried to delete that different ways on page.php like that:

setcookie('name_of_cookie', FALSE, time()-3600);

i also found a version where i only set it to:

setcookie('name_of_cookie');

what just will set a another cookie with the same name like i saw in the settings of the browser. that new cookie has no content - sure, there is no content declared.

i also tried to set a higher time in the past because of the server location but this doesnt work as well. even trying to set the time to just 1 does not work.

i checked the spelling of the name sveral times, there is no failure that comes from different names.

i would be glad if someone could tell what am i doing wrong?

thanks.

图片转代码服务由CSDN问答提供 功能建议

你好我在试图获取的问题上疯了。 < p>我无法删除将在index.php上设置的cookie:

  $ a ='text'; 
setcookie('name_of_cookie',$ a,  time()+ 60 * 60 * 24 * 365); 
   
 
 

在page-php上我可以调用该cookie,内容就像$ a。 我试图在page.php上删除不同的方式:

  setcookie('name_of_cookie',FALSE,time() -  3600); 
  <  / pre> 
 
 

我还找到了一个我只将它设置为的版本:

  setcookie('name_of_cookie'); 
  <  / pre> 
 
 

我将在浏览器的设置中设置另一个具有相同名称的cookie。 新的cookie没有内容 - 当然,没有声明内容。

由于服务器的位置,我也尝试在过去设置更高的时间,但这也不起作用。 甚至试图将时间设置为 1 也不起作用。

我检查了名称的拼写几次,没有来自不同名称的失败 。

如果有人能说出我做错了什么,我会很高兴吗?

谢谢。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题