php cookie删除不了,PHP 无法删除cookie

//$cookie保留时间

//$falg 用户唯一标识符

//$name 用户名

//设置cookie信息

function _setcookie($name,$flag,$time)

{

switch($time)

{

case 0:

setcookie('username',$name);

setcookie('userflag',$flag);

_alert_location('登录成功', 'index.php');

break;

case 1:

setcookie('username',$name,time()+86400);

setcookie('userflag',$flag,time()+86400);

_alert_location('登录成功', 'index.php');

break;

case 2:

setcookie('username',$name,time()+604800);

setcookie('userflag',$flag,time()+604800);

_alert_location('登录成功', 'index.php');

break;

}

}

?>

340e81863c3513d46bf08b3b9793e690.png

d57c8a872bec27c1636edb4a8fd0b87f.png

cb05225ada1c977ae64c8000d2d9d214.png

IE和火狐下都无法删除 请问是什么原因啊?

setcookie(“username”,””,time()-1);

setcookie(“userflag”,””,time()-1);

这样也不行

我已经解决~是path的问题

setcookie(“username”,””,time()-1,’/My_Dome%201.0/’);

这个样子就好了~但是很奇怪本地调试的时候为什么要加上’/My_Dome%201.0/’才行呢 不能是’/’吗?网站正式上线后 怎么修改呢?

更郁闷的是 火狐下和iE下的path不一样~

setcookie(“username”,””,time()-1,’/My_Dome%201.0/’); //火狐下删除方式

setcookie(“userflag”,””,time()-1,’/My_Dome%201.0/’);

setcookie(“username”,””,time()-1,’/My_Dome%201.0′); //IE下删除方式

setcookie(“userflag”,””,time()-1,’/My_Dome%201.0′);

出现这种问题请问有什么好的解决方式~

看看 path 和 domain 是不是写错了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值