如何设置网站的某一个页面不使用smarty缓存
如何设置网站的某一个页面不使用smarty缓存
------最佳解决方案--------------------
在对应的页面使用smarty的对象修改caching属性为false
例如
$smarty->caching = false;
------其他解决方案--------------------
一样的嘛,你还不是要继承Action类
然后在实现的地方 用 $this->_tpl->caching = false;
------其他解决方案--------------------
我是使用mvc模式,在控制器基类进行了统一设置
class Action{
public $_tpl;
function __construct(){
$this->_tpl = new smarty;
$this->_tpl->template_dir = 'view/templates';
$this->_tpl->compile_dir = 'view/templates_c';
$this->_tpl->cache_dir = 'view/cache';
$this->_tpl->config_dir = 'view/config';
$this->_tpl->cache_lifetime = '3600';
$this->_tpl->caching = true;
$this->_tpl->assign('st',$this->_tpl);
}
}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号