开发者

Quick question: How to set a cookie that will expire after 90days in PHP?

I wish to set a cookie that expires in 90 days usi开发者_JS百科ng PHP, how could I do that? Thanks in advance.


setcookie(name, value, time()+60*60*24*90); 

This will set the cookie for 90 Days.


cookie expirations are set in seconds: so 60*60*24*90 would be 90 days

setcookie("MyCookie", $value, time()+(60*60*24*90)); 


Use this:

setcookie('name', 'value', strtotime('NOW+90DAYS'));


setcookie('cookie_name', 'cookie_value', time() + 7776000);

Check out the documentation for more details - http://php.net/manual/en/function.setcookie.php


setcookie("TestCookie", $value, time()+7776000); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜