📄 function.session-cache-expire.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Return current cache expire</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.session.html">Session Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-cache-limiter.html">session_cache_limiter</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.session-cache-expire" class="refentry"> <div class="refnamediv"> <h1 class="refname">session_cache_expire</h1> <p class="verinfo">(PHP 4 >= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">session_cache_expire</span> — <span class="dc-title">Return current cache expire</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><b><b>session_cache_expire</b></b></span> ([ <span class="methodparam"><span class="type">int</span> <tt class="parameter">$new_cache_expire</tt></span> ] )</div> <p class="para rdfs-comment"> <b>session_cache_expire()</b> returns the current setting of <i>session.cache_expire</i>. </p> <p class="para"> The cache expire is reset to the default value of 180 stored in <i>session.cache_limiter</i> at request startup time. Thus, you need to call <b>session_cache_expire()</b> for every request (and before <a href="function.session-start.html" class="function">session_start()</a> is called). </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">new_cache_expire</tt></i></span> <dd> <p class="para"> If <i><tt class="parameter">new_cache_expire</tt></i> is given, the current cache expire is replaced with <i><tt class="parameter">new_cache_expire</tt></i>. </p> <p class="para"> <blockquote><p><b class="note">Note</b>: <span class="simpara"> Setting <i><tt class="parameter">new_cache_expire</tt></i> is of value only, if <i>session.cache_limiter</i> is set to a value <em class="emphasis">different</em> from <i>nocache</i>. </span> </p></blockquote> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the current setting of <i>session.cache_expire</i>. The value returned should be read in minutes, defaults to 180. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>session_cache_expire()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/* set the cache limiter to '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 /></span><span style="color: #FF8000">/* set the cache expire to 30 minutes */<br /></span><span style="color: #0000BB">session_cache_expire</span><span style="color: #007700">(</span><span style="color: #0000BB">30</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cache_expire </span><span style="color: #007700">= </span><span style="color: #0000BB">session_cache_expire</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/* start the session */<br /><br /></span><span style="color: #0000BB">session_start</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #DD0000">"The cache limiter is now set to $cache_limiter<br />"</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">"The cached session pages expire after $cache_expire minutes"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="session.configuration.html#ini.session.cache-expire" class="link">session.cache_expire</a></li> <li class="member"><a href="session.configuration.html#ini.session.cache-limiter" class="link">session.cache_limiter</a></li> <li class="member"><a href="function.session-cache-limiter.html" class="function" rel="rdfs-seeAlso">session_cache_limiter()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.session.html">Session Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-cache-limiter.html">session_cache_limiter</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -