In general, the code is the simplest
setcookie('test', 'test', time()+86400, '/');
Nothing is written to cookies. What could be the problem?
In general, the code is the simplest
setcookie('test', 'test', time()+86400, '/');
Nothing is written to cookies. What could be the problem?
Possible problems:
If you are looking for cookies in $ _COOKIE in the same script where you installed it, you will not find it. Only the next time you run the script
if(setcookie('test', 'test', time()+86400, '/')) echo "Кука установлен"; else echo "Кука не установлен";
But if setcookie () returns true - this does not mean that it will appear at the client, because he could turn off the reception of cookies. Better read about the session.
Source: https://ru.stackoverflow.com/questions/295877/
All Articles