Reputation: 758
It seems that when I try to keep my session cookie, it deletes itself on browser close. The cookie params are set for a lifetime of 0. But when I go in to check it out, the cookie is not there. What is going on here?
Upvotes: 0
Views: 504
Reputation: 1045
when you set lifetime at 0, cookie is deleted when you close your browser
try set a fix value and you should fix your problem.
source : http://php.net/manual/en/function.setcookie.php
Upvotes: 2
Reputation: 11020
If its lifetime is set to 0, the cookie deletes itself when closing the browser. If you want to keep it alive for longer, you need to specify a time, such as 5h or 12m oder 8y.
Use something like this for the time value:
time()+60*60*24*30
In this case the cookie would last 30 days (60-seconds * 60-minutes * 24-hours * 30-days)
Upvotes: 2