--- title: Expires slug: Web/HTTP/Headers/Expires tags: - 缓存,头部,HTTP,响应,response translation_of: Web/HTTP/Headers/Expires --- <div>{{HTTPSidebar}}</div> <div><code><strong>Expires</strong></code> 响应头包含日期/时间, 即在此时候之后,响应过期。</div> <div> </div> <p>无效的日期,比如 0, 代表着过去的日期,即该资源已经过期。</p> <p>如果在{{HTTPHeader("Cache-Control")}}响应头设置了 "max-age" 或者 "s-max-age" 指令,那么 <code>Expires</code> 头会被忽略。</p> <table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td>{{Glossary("Response header")}}</td> </tr> <tr> <th scope="row">{{Glossary("Forbidden header name")}}</th> <td>no</td> </tr> <tr> <th scope="row">{{Glossary("Simple response header", "CORS-safelisted response-header")}}</th> <td>yes</td> </tr> </tbody> </table> <h2 id="语法">语法</h2> <pre class="syntaxbox">Expires: <http-date> </pre> <h2 id="指南">指南</h2> <dl> <dt><http-date></dt> <dd> <p>一个 HTTP-日期 时间戳</p> </dd> </dl> <h2 id="示例">示例</h2> <pre>Expires: 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("7234", "Expires", "5.3")}}</td> <td>Hypertext Transfer Protocol (HTTP/1.1): Caching</td> </tr> </tbody> </table> <h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("http.headers.Expires")}}</p> <h2 id="其他">其他</h2> <ul> <li>{{HTTPHeader("Cache-Control")}}</li> <li>{{HTTPHeader("Age")}}</li> </ul>