出于某种原因,我无法让 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;
最佳答案
如果您希望 smarty 检查,每次使用模板时,是否存在新版本(如果是,则重新编译),那么您可能正在寻找 $compile_check
选项。
在开发过程中,您可能还对这个感兴趣:$force_compile
(引用):
This forces Smarty to (re)compile templates on every invocation.
关于php - 在 PHP Smarty 模板引擎上禁用缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3271610/