if($_GET['test'] == 1) { setCookie('user_hash', 123, time() + 86400, '/'); } echo $_COOKIE['user_hash'];
This is certainly strange, but this cookie lasts for 5-6 minutes and then is removed. How can this be?
Try this, do not specify this parameter at the end "/"
$val="123"; if (setcookie ("user_hash", $val,time()+86400);) echo "<h3>ΠΠ΅ΡΠ΅Π½ΡΡΠΊΠΈ ΠΈΡΠΏΠ΅ΠΊΠ»ΠΈΡΡ!</h3>"; else echo "<h3>ΠΠ΅ΡΠ΅Π½ΡΡΠΊΠΈ, Π½Π΅ ΠΈΡΠΏΠ΅ΠΊΠ»ΠΈΡΡ :(!</h3>";
Well, if a cookie has a 24-hour life, then until you clear the cache of cookies or go through the day, you will have the cookie.
Source: https://ru.stackoverflow.com/questions/151810/
All Articles