setcookie failed using host:: 'localhost'
hello
I cannot get setcookie to work when using this code in php: setcookie("auth", "1", 0, "/", "localhost", 0); when I replace localhost with an empty string like this: setcookie("auth", "1", 0, "/", "", 0); everything works fine. What is the cause this? |
domain
Localhost is a reference for a computer system to it's own webserver. Why would you need cookies for that?
For a public webserver use your fully qualified domain name. Having the '.' (dot) before the domain name seems to help with certain browsers. Maybe you should try ".localhost" or ".localhost.localdomain" if it's only for local testing. Leaving the domain field empty obviously works - making the cookie available to the entire Internet, I guess. Bye, M Linux Archive |
All times are GMT -5. The time now is 09:25 AM. |