ThinkPHP下cookie的有关问题

WBOY
Release: 2016-06-13 12:30:29
Original
946 people have browsed it

ThinkPHP下cookie的问题
为什么我在一个控制器中删除了某控制器的变量,但是在另外一个控制器中确依然可以正常的读取cookie,var_dump($_COOKIE)之后发现变量并未被删除。请问这是为什么?
在A控制器设置cookie

setcookie('username', $inputUsername, time() + 60 * 60 * 24 * 14, '/');
Copy after login

在B中删除
setcookie('username', '', time()-3600, '/');
Copy after login


我分别在两个控制器中打印出$_COOKIE变量,一个已经被删除了一个未被删除,两个cookie的PHPSESSID是一样的。

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