smarty模板引擎强制编译

默认情况下,模板会进行缓存,如果不希望模板进行缓存,

$smarty->force_compile = true;

另外,可以使用 nocache 局部禁止缓存

{nocache}
  {*通过{nocache}标签进行无缓存设置 *}
  {$smarty.now|date_format}
{/nocache}
  {*通过nocache属性进行无缓存设置*}
{$smarty.now|date_format nocache}

另外在开发模式时,尽量不要缓存,可为程序自定义一个debug模式,如果开启该模式则强制编译。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注