Answer the question
In order to leave comments, you need to log in
How to create a cookie correctly?
I'm trying to create a cookie like this:
$domain = str_replace('www.', '', $_SERVER['HTTP_HOST']); //localhost
setcookie ('cookie', 'value', time()+(60*60*24*30), '/', $domain, true, true);
but I can’t understand, then it was created like, now it has ceased to be created.
I try to create setcookie ('cookie', 'value', time()+(60*60*24*30), '/');
what about $domain, true, true?
Answer the question
In order to leave comments, you need to log in
Read the documentation , please.
$domain, true, true - optional parameters. In general , all parameters are optional, except for the first one.
How do you check if a cookie has been created? Have you tried looking in devtools or firebug? (F12)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question