set get cookie php code example
Example 1: get a cookie in php
<?php
echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!';
?>
Example 2: php set cookie
<?php
$name = 'COOKIE_NAME';
$value = 'VALUE';
$expireTime = strtotime('+1 years');
$path = '/';
setcookie($name,$value,$expireTime,$path);