2010-07-17 74 views
7

出於某種原因,我無法讓Smarty停止緩存模板,這在開發過程中對模板進行更改時非常煩人。誰能告訴我,我要去哪裏錯了禁用所有緩存?:禁用PHP 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; 

回答

8

如果你想Smarty的檢查,使用模板每次,如果它的一個新的版本存在(並重新編譯如果是這種情況),那麼你可能正在尋找$compile_check選項。


在深化發展,你也可能被這個感興趣的是:$force_compile(引用)

強迫Smarty(重新)每次調用編譯 模板。

+0

完美的,由於某種原因,我從來沒有注意到說明書中的$強迫編譯選項。謝謝! – Rob 2010-07-17 13:22:30

+0

不客氣:-)玩得開心! – 2010-07-17 13:26:39

0

默認:

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

改變上面的代碼:

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