Answers for "php clear cookie"

PHP
3

php remove cookie

if (isset($_COOKIE['key'])) {
    unset($_COOKIE['key']);
    setcookie('key', '', time() - 3600, '/'); // empty value and old timestamp
}
Posted by: Guest on May-28-2021
0

remove cookies php

unset($_COOKIE['hello']);
Posted by: Guest on November-14-2020
4

php cookies

//Cookies
//Cookies are stored on the client side. cookies are not as secure as sessions
//and it is recommended that you use sessions as much as possible.
//save addional information as an array in a cookie
<?php
    $user = ['name' => 'Brad', 'email' => '[email protected]', 'age' = 35];

    $user = serialize($user);

    setcookie('user', $user, time() + (86400 *30));
    
    $user = unserialize($_COOKIE['user']);

    echo $user['name'];
Posted by: Guest on May-13-2020
3

cookies php syntax

setcookie("cookie_name", "type_on_cookie", expiry_time(), "/");
Posted by: Guest on July-29-2020

Browse Popular Code Answers by Language