Google Chrome浏览器最大Cookie到期日期 [英] Google Chrome maximum cookie expiry date

查看:1455
本文介绍了Google Chrome浏览器最大Cookie到期日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  setcookie('subscribed',' true',time()+ 365 * 24 * 3600 * 100,'/',null,false,true); 

我意识到我的浏览器(Google Chrome)拒绝获取该Cookie。当我在Google Chrome中查看我的Cookie时,它不在那里。我开始使用不同的设置,直到我看到这个工作:

  setcookie('subscribed','true',time )+ 365 * 24 * 360,'/',null,false,true); 

这意味着将到期时间更改为更低的值确实是一种工作方式。



我的问题是,您可以为Google Chrome中的Cookie设置的最低到期时间是多少?

解决方案

我刚刚在64位操作系统上尝试使用Chrome作为浏览器,Apache作为服务器,它的工作完美无瑕。



dev-null-dweller 可能是对的:超过03的任何日期: 14:07 UTC于 2038年1月19日星期二将绕过1900年左右的某个时间,从而迫使Cookie立即消失(在32位平台上,也就是)。



通过将cookie过期时间设置为将来不超过10年,可以解决此问题。这已经超出了合理预期的任何电子设备的寿命,无论如何,它将持有它。


I was creating my website when I created a new cookie with this php line :

setcookie('subscribed', 'true', time() + 365*24*3600*100, '/', null, false, true);

I realised my browser (Google Chrome) refused to get that cookie. When I looked at my cookies in Google Chrome it wasn't there. I started fiddling with the different settings until I saw that this worked :

setcookie('subscribed', 'true', time() + 365*24*360, '/', null, false, true);

Which meant that changing the expiration time to a lower value did work as a means of making this work.

My question is, what is the lowest expiration time you can set for a cookie in Google chrome? Does anyone know of this policy?

解决方案

I have just tried that on a 64bit OS with Chrome as a browser and Apache as a server, and it works flawlessly. It shows the cookie's expiration time to be somewhere in the year 2113.

dev-null-dweller is probably right: Any date beyond 03:14:07 UTC on Tuesday, 19 January 2038 will wrap around to some time close to 1900, thus forcing the cookie to immediately disappear (on 32bit platforms, that is).

Work around this by setting cookie expiration times to be no more than 10 years in the future, or so. This is already beyond the reasonably expectable lifetime of any electronic device, which will hold it, anyways.

这篇关于Google Chrome浏览器最大Cookie到期日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆