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/api/headers/values | |
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/api/headers/values')
-rw-r--r-- | files/zh-cn/web/api/headers/values/index.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/headers/values/index.html b/files/zh-cn/web/api/headers/values/index.html new file mode 100644 index 0000000000..293957bd3d --- /dev/null +++ b/files/zh-cn/web/api/headers/values/index.html @@ -0,0 +1,54 @@ +--- +title: Headers.values() +slug: Web/API/Headers/values +translation_of: Web/API/Headers/values +--- +<div>{{APIRef}}</div> + +<p><code><strong>Headers.values()</strong></code>方法返回一个可迭代数值,通过这个数值可以遍历<code><strong>Headers</strong></code>中键值对的<code><strong>value</strong></code>值。返回的<code><strong>value</strong></code>都是<strong><code>ByteString</code></strong>对象。</p> + +<div class="note"> +<p><strong>注意</strong>: 这个方法可以在 <a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>中使用。</p> +</div> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">headers.values();</pre> + +<h3 id="返回值">返回值</h3> + +<p>返回一个由键值对中<strong><code>value</code></strong>组成的数组。</p> + +<h2 id="例子">例子</h2> + +<pre class="brush: js;highlight:[7]">// Create a test Headers object +var myHeaders = new Headers(); +myHeaders.append('Content-Type', 'text/xml'); +myHeaders.append('Vary', 'Accept-Language'); + +// Display the values +for (var value of myHeaders.values()) { + console.log(value); +} +</pre> + +<p>返回值为:</p> + +<pre>text/xml +Accept-Language</pre> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div> + + +<p>{{Compat("api.Headers.values")}}</p> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li> + <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li> + <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li> +</ul> |