<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><th colspan="3" align="center">Smarty - the compiling PHP template engine</th></tr><tr><td width="25%" align="left" valign="bottom"><a href="language.function.literal.html" accesskey="P">Prev</a></td> <td width="50%" align="center" valign="bottom">Chapter 7. Built-in Functions[第七章.内建函数]</td> <td width="25%" align="right" valign="bottom"><a href="language.function.php.html" accesskey="N">Next</a></td></tr></table> # {nocache}禁止缓存 {nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}. {nocache}用来禁止模版块缓存,每个{nocache}应与{/nocache}成对出现。 <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 提示 </caption> <tr><td>Note<br/>Be sure any variables used within a non-cached section are also assigned from PHP when the page is loaded from the cache.<br/>当从缓存中加载页面时应确定无缓存块使用的变量为php变量(而非模板中定义的变量)。</td> </tr></table> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="EXAMPLE"><tr><td><div class="EXAMPLE"> <p><a name="AEN2757" id="AEN2757"/><b><span class="PROGRAMLISTING">Example 7.57. Preventing a template section from being cached</span><br/> 例 7-57. 防止缓存模版块</b></p> <table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="PROGRAMLISTING">Today's date is{nocache}{$smarty.now|date_format}{/nocache}</pre></td></tr></table><p>The above code will output the current date on a cached page.<br/> See also the caching section.</p> <p>上述代码将输出缓存页面上的当前时间。参见<a href="caching.html">缓存</a>一章。</p></div></td></tr></table> | [Prev](#) | [Home](#) | [Next](#) | |-----|-----|-----| | {literal} | [Up](#) | {php} |