Answers for "php set cookie get cookie"

PHP
1

get a cookie in php

<?php
echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!';
?>
Posted by: Guest on October-01-2020
2

php set cookie

<?php
  $name = 'COOKIE_NAME';
  $value = 'VALUE';
  $expireTime = strtotime('+1 years');
  $path = '/';
  setcookie($name,$value,$expireTime,$path);
Posted by: Guest on December-09-2020

Browse Popular Code Answers by Language