logo
Blog single photo

php set get and delete cookies


                        

SET COOKIES

<?php
$cookie_name = "feedcook";
$cookie_value = "DIPANKAR";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/");


?>

GET COOKIES

<?php
if(isset($_COOKIE['feedcook'])) {
  
    echo "Value is: " . $_COOKIE['feedcook'];
}
?>


DELETE COOKIES

<?php
if(isset($_COOKIE['feedcook'])):
        setcookie('feedcook', '', time()-7000000, '/');
    endif;
?>

Top