mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
181 lines
7.0 KiB
HTML
181 lines
7.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>读取/设置缓存限制器</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.session-cache-limiter" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">session_cache_limiter</h1>
|
||
<p class="verinfo">(PHP 4 >= 4.0.3, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">session_cache_limiter</span> — <span class="dc-title">读取/设置缓存限制器</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.session-cache-limiter-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>session_cache_limiter</strong></span>
|
||
([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$cache_limiter</code></span>
|
||
] ) : <span class="type">string</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>session_cache_limiter()</strong></span> 返回当前缓存限制器的名称。
|
||
</p>
|
||
<p class="para">
|
||
缓存限制器定义了向客户端发送的 HTTP 响应头中的缓存控制策略。
|
||
客户端或者代理服务器通过检测这个响应头信息来
|
||
确定对于页面内容的缓存规则。
|
||
设置缓存限制器为 <em>nocache</em> 会进制客户端或者代理服务器缓存内容,
|
||
<em>public</em> 表示允许客户端或代理服务器缓存内容,
|
||
<em>private</em> 表示允许客户端缓存,
|
||
但是不允许代理服务器缓存内容。
|
||
</p>
|
||
<p class="para">
|
||
在 <em>private</em> 模式下, 包括 <span class="productname">Mozilla</span>
|
||
在内的一些浏览器可能无法正确处理 Expire 响应头,
|
||
通过使用 <em>private_no_expire</em> 模式可以解决这个问题:在这种模式下,
|
||
不会向客户端发送 <em>Expire</em> 响应头。
|
||
</p>
|
||
<p class="para">
|
||
设置为 <em>''</em> 可以关闭
|
||
自动发送缓存策略响应头的功能。
|
||
</p>
|
||
<p class="para">
|
||
请求开始的时候,缓存限制器会被重置为默认值,并且存储在
|
||
<a href="session.configuration.html#ini.session.cache-limiter" class="link">session.cache_limiter</a>
|
||
配置项中。
|
||
因此,如果要设置缓存限制器,对于每个请求,
|
||
都需要在调用 <span class="function"><a href="session_start.html" class="function">session_start()</a></span> 函数之前,
|
||
调用 <span class="function"><strong>session_cache_limiter()</strong></span> 函数来进行设置。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.session-cache-limiter-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">cache_limiter</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
如果指定了 <code class="parameter">cache_limiter</code> 参数,
|
||
将使用指定值作为缓存限制器的值。
|
||
</p>
|
||
<table class="doctable table">
|
||
<caption><strong>可选的值</strong></caption>
|
||
|
||
<thead>
|
||
<tr>
|
||
<th>值</th>
|
||
<th>发送的响应头</th>
|
||
</tr>
|
||
|
||
</thead>
|
||
|
||
<tbody class="tbody">
|
||
<tr>
|
||
<td><em>public</em></td>
|
||
<td>
|
||
<div class="example-contents">
|
||
<div class="headercode"><pre class="headercode">Expires:(根据 session.cache_expire 的设定计算得出)
|
||
Cache-Control: public, max-age=(根据 session.cache_expire 的设定计算得出)
|
||
Last-Modified:(会话最后保存时间)</pre>
|
||
</div>
|
||
</div>
|
||
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>private_no_expire</em></td>
|
||
<td>
|
||
<div class="example-contents">
|
||
<div class="headercode"><pre class="headercode">Cache-Control: private, max-age=(根据 session.cache_expire 的设定计算得出), pre-check=(根据 session.cache_expire 的设定计算得出)
|
||
Last-Modified: (会话最后保存时间)</pre>
|
||
</div>
|
||
</div>
|
||
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>private</em></td>
|
||
<td>
|
||
<div class="example-contents">
|
||
<div class="headercode"><pre class="headercode">Expires: Thu, 19 Nov 1981 08:52:00 GMT
|
||
Cache-Control: private, max-age=(根据 session.cache_expire 的设定计算得出), pre-check=(根据 session.cache_expire 的设定计算得出)
|
||
Last-Modified: (会话最后保存时间)</pre>
|
||
</div>
|
||
</div>
|
||
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>nocache</em></td>
|
||
<td>
|
||
<div class="example-contents">
|
||
<div class="headercode"><pre class="headercode">Expires: Thu, 19 Nov 1981 08:52:00 GMT
|
||
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
||
Pragma: no-cache</pre>
|
||
</div>
|
||
</div>
|
||
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.session-cache-limiter-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
返回当前所用的缓存限制器名称。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.session-cache-limiter-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-5830">
|
||
<p><strong>Example #1 <span class="function"><strong>session_cache_limiter()</strong></span> 示例</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/* 设置缓存限制器为 'private' */<br /><br /></span><span style="color: #0000BB">session_cache_limiter</span><span style="color: #007700">(</span><span style="color: #DD0000">'private'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cache_limiter </span><span style="color: #007700">= </span><span style="color: #0000BB">session_cache_limiter</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #DD0000">"The cache limiter is now set to </span><span style="color: #0000BB">$cache_limiter</span><span style="color: #DD0000"><br />"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.session-cache-limiter-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><a href="session.configuration.html#ini.session.cache-limiter" class="link">session.cache_limiter</a></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |