blob: f8b47d534b7bf39af046203df07653cf7b0ce9e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
---
title: Cookie
slug: Web/HTTP/Headers/Cookie
tags:
- Cookies
- HTTP
- 请求
- 超文本传输协议
- 首部
translation_of: Web/HTTP/Headers/Cookie
---
<div>{{HTTPSidebar}}</div>
<p><strong><code>Cookie</code></strong> 是一个请求首部,其中含有先前由服务器通过 {{HTTPHeader("Set-Cookie")}} 首部投放并存储到客户端的 <a href="/en-US/docs/Web/HTTP/Cookies">HTTP cookies</a>。</p>
<p>这个首部可能会被完全移除,例如在浏览器的隐私设置里面设置为禁用cookie。</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>yes</td>
</tr>
</tbody>
</table>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">Cookie: <cookie-list>
Cookie: name=value
Cookie: name=value; name2=value2; name3=value3</pre>
<dl>
<dt><cookie-list></dt>
<dd>一系列的名称/值对,形式为 <code><cookie-name>=<cookie-value>。</code>名称/值对之间用分号和空格 ('; ')隔开。</dd>
</dl>
<h2 id="示例">示例</h2>
<pre>Cookie: PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;</pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Title</th>
</tr>
<tr>
<td>{{RFC("6265", "Cookie", "5.4")}}</td>
<td>HTTP State Management Mechanism</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("http.headers.Cookie")}}</p>
<h2 id="相关内容">相关内容</h2>
<ul>
<li>{{HTTPHeader("Set-Cookie")}}</li>
<li>{{domxref("Document.cookie")}}</li>
</ul>
|