为什么是“过期”? 1981 年?
我的 CRON 作业返回了一个错误,指出 CRON 作业不起作用。就在那里:
Set-Cookie: PHPSESSID=2t2drultihqci4em15nbfmeb63; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html
我想知道为什么 Expires
设置为“1981”。有什么意义呢?
My CRON Job returned an error that CRON job did not work. In that this was there:
Set-Cookie: PHPSESSID=2t2drultihqci4em15nbfmeb63; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html
I am wondering why is Expires
set to "1981". What is the significance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是禁用缓存的尝试。
该日期是添加代码的开发人员 Sascha Schumann 的生日。
来自会话.c:
It's an attempt to disable caching.
The date is the birthday of the developer Sascha Schumann who added the code.
From session.c:
HTTP 过期标头
http://www.w3.org/Protocols/rfc2616/rfc2616- sec13.html
设置为负数或过去的值,以防止缓存响应。
这个标头的用法很常见。
HTTP Expires header
http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
It is set to negative or past value, to prevent caching of response.
Quite common usage of this header.
我认为您在调用
session_start
之前使用了session_cache_limiter
。如果参数是private
或no-cache
,结果是将Expires
标头设置为您提到的时间。请参阅此文档了解更多信息。I think you are using
session_cache_limiter
before callingsession_start
. If argument isprivate
orno-cache
the result is setting theExpires
header to the time you have mentioned. Refer to this document for more information.有人只是将
expires = date('-30years')
(解释)放入他的代码中,以确保内容被设置为过期且不被缓存。Somebody just put
expires = date('-30 years')
(paraphrased) in his code to make really sure the content is set as expired and not cached.