Home > Backend Development > PHP Problem > What to do if PHP fails to clear cookies

What to do if PHP fails to clear cookies

藏色散人
Release: 2023-03-13 20:40:02
Original
2125 people have browsed it

php fails to clear cookies because the path parameter of the cookie does not correspond. The solution is to modify the deletion code to "setcookie($key,"",time()-36000,'/');" .

What to do if PHP fails to clear cookies

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

What should I do if php fails to clear cookies?

The reason why php cookie cannot be deleted

Cookie can be deleted through setcookie(name, value, expiration, path, host, secure, httponly);

is guaranteed If the cookie names are the same, if they still cannot be deleted, it means that the path parameters of the cookies do not correspond.

setcookie($key,$value,time()+36000,'/');
Copy after login

The slash behind it indicates the path, which must be consistent.

Recommended learning: "

PHP Video Tutorial

"

The above is the detailed content of What to do if PHP fails to clear cookies. For more information, please follow other related articles on the PHP Chinese website!

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