<?php
$cookie_name = "user";
$cookie_value = "david";
setcookie($cookie_name, $cookie_value, time() - (86400 * 30), "/"); //subtraction from time causes deletion of cookie
In above section i am trying to delete a cookie by setting that cookie in past time. But here below when i try to check whether cookie is enabled or not. it returns if case rather than else part, while i already dell that cookie.
if(count($_COOKIE) > 0) //counting number of cookies
{
echo "<br>Cookies are enabled/exists";
}
else //else part is not working when we delete cookie >> don't know why
{
echo "<br>Cookies are disabled/not exists";
}
?>
Aucun commentaire:
Enregistrer un commentaire