请教 Cookie 清空相关问题!

startnow 2004-05-04 03:35:00
|-Web/
|-/Admin/a.php
|-b.php
------------------

若在b.php a.php 中 setcookie 了相同名称相同值的cookie 为何只能在b.php 中将其清空 而在a.php 中无效? 若b.php 不设定同名cookie a.php 则能正常清空!
...全文
109 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzkd 2004-05-04
  • 打赏
  • 举报
回复
在设定cookie的时候,有两点情况可能会导致楼主的问题.
1、在设定cookie的时候加了路径,含路径的cookie是不能随便被清空的。
2、php的cookie传递比较慢,清空后不会马上消失,你再刷新一下看看,也许就可以了。
chinaworker 2004-05-04
  • 打赏
  • 举报
回复
bool setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])


path:
If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.
startnow 2004-05-04
  • 打赏
  • 举报
回复
setookie('aa','1');

未添加 path。

如何处理?

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧