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

Methods to create COOKIE and destroy COOKIE in PHP7

angryTom
angryTomforward
2020-02-02 21:40:503350browse

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

setrawcookie() and then output the value as it is

2, Destroy COOKIE

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

3, Get COOKIE value

echo $_COOKIE["TestCookie"];

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!

Statement:
This article is reproduced at:51cto.com. If there is any infringement, please contact admin@php.cn delete