Home >Backend Development >PHP Problem >How to clear cookies in php

How to clear cookies in php

coldplay.xixi
coldplay.xixiOriginal
2020-11-02 14:01:512586browse

How to clear cookies in php: 1. Delete directly, the code is [setcookie("users");]; 2. Clear it by setting the expiration time, the code is [setcookie("users","OKadmin" ,time()-1);setcookie(....)].

How to clear cookies in php

How to clear cookies in php:

There are two ways to delete cookies

One: Delete directly

setcookie("users");

Two: Set the expiration time

setcookie("users","OKadmin",time()-1);
setcookie("users","OKadmin",0); //浏览器关闭 是自动失效

Related video recommendations:PHP Programming from beginner to master

The above is the detailed content of How to clear cookies in php. For more information, please follow other related articles on the PHP Chinese website!

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