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,'/');" .
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,'/');
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!