I've created a cookie expire time 60 days... But now I am not able to delete cooking. I am using this function to delete cookie. When I refresh page then cookie is again there.
function delete_cookie($key_name)
{
$expire = time() - 3600;
setcookie($key_name, '', $expire, '/');
unset($_COOKIE[$key_name]);
}
try this
function delete_cookie($key_name)
{
$expire = time() - 3600;
$dimain = $_SERVER['HTTP_HOST'];
setcookie($key_name, '', $expire, '/', $domain);
}
also you don't need unset()
Edit:
assuming that $key_name
is the cookie name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.