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