aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/status/307
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/http/status/307
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/http/status/307')
-rw-r--r--files/zh-cn/web/http/status/307/index.html52
1 files changed, 52 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/status/307/index.html b/files/zh-cn/web/http/status/307/index.html
new file mode 100644
index 0000000000..0025be78af
--- /dev/null
+++ b/files/zh-cn/web/http/status/307/index.html
@@ -0,0 +1,52 @@
+---
+title: 307 Temporary Redirect
+slug: Web/HTTP/Status/307
+tags:
+ - HTTP
+ - 参考
+ - 响应状态码
+ - 状态码
+ - 重定向
+translation_of: Web/HTTP/Status/307
+---
+<div>{{HTTPSidebar}}</div>
+
+<p>{{Glossary("HTTP")}} <code><strong>307 Temporary Redirect</strong></code>,临时重定向响应状态码,表示请求的资源暂时地被移动到了响应的 {{HTTPHeader("Location")}} 首部所指向的 URL 上。</p>
+
+<p>原始请求中的请求方法和消息主体会在重定向请求中被重用。在确实需要将重定向请求的方法转换为 {{HTTPMethod("GET")}} 的场景下,可以考虑使用 {{HTTPStatus("303", "303 See Other")}} 状态码。例如,在使用 {{HTTPMethod("PUT")}} 方法进行文件上传操作时,如果需要返回一条确认信息(例如“你已经成功上传了 XYZ”),而不是返回上传的资源本身,就可以使用这个状态码。</p>
+
+<p>状态码 <code>307</code> 与 {{HTTPStatus("302")}} 之间的唯一区别在于,当发送重定向请求的时候,<code>307</code> 状态码可以确保请求方法和消息主体不会发生变化。如果使用 <code>302</code> 响应状态码,一些旧客户端会错误地将请求方法转换为 {{HTTPMethod("GET")}}:也就是说,在 Web 中,如果使用了 <code>GET</code> 以外的请求方法,且返回了 <code>302</code> 状态码,则重定向后的请求方法是不可预测的;但如果使用 <code>307</code> 状态码,之后的请求方法就是可预测的。对于 <code>GET</code> 请求来说,两种情况没有区别。</p>
+
+<h2 id="状态码">状态码</h2>
+
+<pre class="syntaxbox">307 Temporary Redirect
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">标题</th>
+ </tr>
+ <tr>
+ <td>{{RFC("7231", "307 Temporary Redirect" , "6.4.7")}}</td>
+ <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</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.status.307")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{HTTPStatus("302", "302 Found")}}, the equivalent of this status code, but that may change the method used when it is not a {{HTTPMethod("GET")}}.</li>
+ <li>{{HTTPStatus("303", "303 See Other")}}, a temporary redirect that changes the method used to {{HTTPMethod("GET")}}.</li>
+ <li>{{HTTPStatus("301", "301 Moved Permanently")}}, a permanent redirect</li>
+</ul>