Home > Backend Development > PHP Tutorial > Methods to create COOKIE and destroy COOKIE in PHP7

Methods to create COOKIE and destroy COOKIE in PHP7

angryTom
Release: 2023-04-08 12:20:01
forward
3397 people have browsed it

This article introduces the method of creating and destroying COOKIE in PHP7. It has certain reference value. Now I share it with you. I hope it will be helpful to students learning PHP development!

Methods to create COOKIE and destroy COOKIE in PHP7

1, how to set COOKIE

setcookie ( string $name [, string $value = "" [, int $expire = 0 [, string $path = "" [, string $domain = "96net.com.cn" [, bool $secure = false [, bool $httponly = false ]]]]]] ) : bool
Copy after login

setrawcookie() and then output the value as it is

2, Destroy COOKIE

setcookie("TestCookie", $value, time()-3600);
Copy after login

3, Get COOKIE value

echo $_COOKIE["TestCookie"];
Copy after login

Recommended related articles and tutorials: php tutorial

The above is the detailed content of Methods to create COOKIE and destroy COOKIE in PHP7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:51cto.com
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