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

How to clear cookies in php

Guanhui
Release: 2023-03-01 06:22:02
Original
3785 people have browsed it

How to clear cookies in php

How to clear cookies in php

1. Use the function "setcookie()" to set the cookie value to empty or NULL;

//将cookie值设置为空
setcookie ("name", "");
//或者将cookie值设置null
setcookie ("name", null);
Copy after login

2. By setting the cookie expiration time to the past time, just set the third parameter of "setcookie()" to "time()-1".

setcookie ("name", "xiaoming", time() - 1);
Copy after login

Recommended tutorial: "PHP Tutorial"

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:
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