diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/http/headers/if-modified-since | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/http/headers/if-modified-since')
-rw-r--r-- | files/zh-cn/web/http/headers/if-modified-since/index.html | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/if-modified-since/index.html b/files/zh-cn/web/http/headers/if-modified-since/index.html new file mode 100644 index 0000000000..dd7e213358 --- /dev/null +++ b/files/zh-cn/web/http/headers/if-modified-since/index.html @@ -0,0 +1,92 @@ +--- +title: If-Modified-Since +slug: Web/HTTP/Headers/If-Modified-Since +tags: + - 条件请求 + - 请求头 +translation_of: Web/HTTP/Headers/If-Modified-Since +--- +<div>{{HTTPSidebar}}</div> + +<p><strong><code>If-Modified-Since</code></strong> 是一个条件式请求首部,服务器只在所请求的资源在给定的日期时间之后对内容进行过修改的情况下才会将资源返回,状态码为 {{HTTPStatus("200")}} 。如果请求的资源从那时起未经修改,那么返回一个不带有消息主体的 {{HTTPStatus("304")}} 响应,而在 {{HTTPHeader("Last-Modified")}} 首部中会带有上次修改时间。 不同于 {{HTTPHeader("If-Unmodified-Since")}}, <code>If-Modified-Since</code> 只可以用在 {{HTTPMethod("GET")}} 或 {{HTTPMethod("HEAD")}} 请求中。</p> + +<p>当与 {{HTTPHeader("If-None-Match")}} 一同出现时,它(<strong><code>If-Modified-Since</code></strong>)会被忽略掉,除非服务器不支持 <code>If-None-Match</code>。</p> + +<p>最常见的应用场景是来更新没有特定 {{HTTPHeader("ETag")}} 标签的缓存实体。</p> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">Header type</th> + <td>{{Glossary("Request header")}}</td> + </tr> + <tr> + <th scope="row">{{Glossary("Forbidden header name")}}</th> + <td>no</td> + </tr> + </tbody> +</table> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT +</pre> + +<h2 id="指令">指令</h2> + +<dl> + <dt><day-name></dt> + <dd> "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 或 "Sun" 之一 (区分大小写)。</dd> + <dt><day></dt> + <dd>两位数字表示的天数, 例如"04" or "23"。</dd> + <dt><month></dt> + <dd>"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" 之一(区分大小写)。</dd> + <dt><year></dt> + <dd>4位数字表示的年份, 例如 "1990" 或者"2016"。</dd> + <dt><hour></dt> + <dd>两位数字表示的小时数, 例如 "09" 或者 "23"。</dd> + <dt><minute></dt> + <dd>两位数字表示的分钟数,例如"04" 或者 "59"。</dd> + <dt><second></dt> + <dd>两位数字表示的秒数,例如 "04" 或者 "59"。</dd> + <dt><code>GMT</code></dt> + <dd> + <p>国际标准时间。HTTP中的时间均用国际标准时间表示,从来不使用当地时间。</p> + </dd> +</dl> + +<h2 id="示例">示例</h2> + +<pre>If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Title</th> + </tr> + <tr> + <td>{{RFC("7232", "If-Modified-Since", "3.3")}}</td> + <td>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("http.headers.If-Modified-Since")}}</p> + +<h2 id="相关内容">相关内容</h2> + +<ul> + <li>{{HTTPHeader("ETag")}}</li> + <li>{{HTTPHeader("If-Unmodified-since")}}</li> + <li>{{HTTPHeader("If-Match")}}</li> + <li>{{HTTPHeader("If-None-Match")}}</li> + <li>{{HTTPStatus("304")}}<code> Not Modified</code></li> +</ul> |