禁用 PHP Smarty 模板引擎的缓存?

7

由于某些原因,我无法让Smarty停止缓存模板,在开发过程中修改模板时非常烦人。有人能告诉我在禁用所有缓存方面出了什么问题吗?

$smarty                 =   new Smarty();
$smarty->template_dir   =   SMARTY_PATH."/templates";
$smarty->compile_dir    =   SMARTY_PATH."/templates_c";
$smarty->cache_dir      =   SMARTY_PATH."/cache";
$smarty->config_dir     =   SMARTY_PATH."/configs";
$smarty->cache_lifetime = 1;
$smarty->caching = 0;
2个回答

10
如果你想让Smarty在每次使用模板时检查是否存在新版本(如果是,则重新编译它),那么你可能正在寻找 $compile_check 选项。
在开发过程中,你可能也会对这个选项感兴趣:$force_compile (引用):

这将强制Smarty在每次调用时重新编译模板。


完美,出于某种原因我从未在手册中注意到$force_compile选项。谢谢! - Rob

1
默认情况下:

var $force_compile   =  false; / public $force_compile = false;

将上述代码更改为:

更改上面的代码为:

var $force_compile   =  true;  /   public $force_compile = true;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接