Home  >  Article  >  Backend Development  >  setcookie的有关问题

setcookie的有关问题

WBOY
WBOYOriginal
2016-06-13 12:50:12831browse

setcookie的问题
setcookie('uid', $id);

1.如果第三参数不传,是不是就是退出浏览器cookie就失效?

2.我用jquery的$ajax调用php,php里执行了setcookie('uid', $id, $cookietime, '/', '.xxx.net', 0);
在$ajax success里reload了页面,为什么取不到cookie?
而且在%temp%\..\Temporary Internet Files目录下也看不到对应网站的cookie文件。


------解决方案--------------------
setcookie('uid',null)
------解决方案--------------------
统一一下,不用这个setcookie('uid');
setcookie("uid", "", time() - 3600);比较标准
------解决方案--------------------
因为你没有设置作用域
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn