smarty什么时候会从新编译template

从smarty.class.php文件中的下列代码可以看出来:

   /**
* test if resource needs compiling
*
* @param string $resource_name
* @param string $compile_path
* @return boolean
*/
function _is_compiled($resource_name, $compile_path)
{
if (!$this->force_compile && file_exists($compile_path)) {
if (!$this->compile_check) {
// no need to check compiled file
return true;
} else {
// get file source and timestamp
$_params = array('resource_name' => $resource_name, 'get_source'=>false);
if (!$this->_fetch_resource_info($_params)) {
return false;
}
if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
// template not expired, no recompile
return true;
} else {
// compile template
return false;
}
}
} else {
// compiled template does not exist, or forced compile
return false;
}
}


首先会看,是否设置了force_compile,如果为true,那么每次都要进行重新编译。
然后看是否要compile_check,如果为false,那么永远不会进行编译。
如果为true,那么进行检查,检查什么呢?检查文件的修改时间,[color=red]如果编译结果的时间>=原模板文件的修改时间,那么不进行重新编译,否则进行编译。[/color]

关键在于这个“等号”,我们应该将这个“=”去掉呢?还是他真的有必要?

有事,待续...
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值