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

How to clear cookies in php

coldplay.xixi
Release: 2023-03-06 22:44:02
Original
2600 people have browsed it

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");
Copy after login

Two: Set the expiration time

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

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!

Related labels:
php
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