最大值:2147483647
setcookie("CookieName", "CookieValue", 2147483647);
为避免整数溢出,时间戳记应设置为:
2^31 - 1 = 2147483647 = 2038-01-19 04:14:07
设置较高的值可能会导致旧版浏览器出现问题。
另请参阅有关cookie的RFC:
Max-Age=value
OPTIONAL. The value of the Max-Age attribute is delta-seconds,
the lifetime of the cookie in seconds, a decimal non-negative
integer. To handle cached cookies correctly, a client SHOULD
calculate the age of the cookie according to the age calculation
rules in the HTTP/1.1 specification [RFC2616]. When the age is
greater than delta-seconds seconds, the client SHOULD discard the
cookie. A value of zero means the cookie SHOULD be discarded
immediately.
和RFC 2616、14.6年龄:
如果缓存收到的值大于它可以表示的最大正整数,或者如果任何年龄计算溢出,则它必须发送一个年龄值为2147483648(2 ^ 31)的Age标头。
http://www.faqs.org/rfcs/rfc2616.html