php 为什么“过期”是 1981 年?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8194481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is "Expires" 1981?
提问by footy
My CRON Job returned an error that CRON job did not work. In that this was there:
我的 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
I am wondering why is Expires
set to "1981". What is the significance?
我想知道为什么Expires
设置为“1981”。有什么意义?
回答by Mark Byers
It's an attempt to disable caching.
这是禁用缓存的尝试。
The date is the birthday of the developer Sascha Schumannwho added the code.
日期是添加代码的开发人员Sascha Schumann的生日。
From session.c:
从 session.c:
Authors: Sascha Schumann <[email protected]>
Andrei Zmievski <[email protected]>
// ...
CACHE_LIMITER_FUNC(private)
{
ADD_HEADER("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
CACHE_LIMITER(private_no_expire)(TSRMLS_C);
}
回答by Marek Sebera
HTTP Expires header
HTTP 过期标头
http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
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.
此标头的常见用法。
回答by Ashwini Dhekane
I think you are using session_cache_limiter
before calling session_start
. If argument is private
or no-cache
the result is setting the Expires
header to the time you have mentioned. Refer to thisdocument for more information.
我认为您session_cache_limiter
在调用session_start
. 如果参数是private
或no-cache
结果将Expires
标题设置为您提到的时间。有关更多信息,请参阅此文档。
回答by deceze
Somebody just put expires = date('-30 years')
(paraphrased) in his code to make really sure the content is set as expired and not cached.
有人只是expires = date('-30 years')
在他的代码中放入(释义)以确保将内容设置为已过期而不是缓存。