Home > Backend Development > PHP Tutorial > setcookie的有关问题

setcookie的有关问题

WBOY
Release: 2016-06-13 11:19:14
Original
886 people have browsed it

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);比较标准
------解决方案--------------------
因为你没有设置作用域
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template