uchome 不从缓存中读取模板

时间:2023-03-09 03:19:19
uchome 不从缓存中读取模板

/source/function_common.php中的代码

//模板调用
function template($name) {
global $_SCONFIG, $_SGLOBAL; if($_SGLOBAL['mobile']) {
$objfile = S_ROOT.'./api/mobile/tpl_'.$name.'.php';
if (!file_exists($objfile)) {
showmessage('m_function_is_disable_on_wap');
}
} else {
if(strexists($name,'/')) {
$tpl = $name;
} else {
$tpl = "template/$_SCONFIG[template]/$name";
}
$objfile = S_ROOT.'./data/tpl_cache/'.str_replace('/','_',$tpl).'.php';
//修改后的内容,实现缓存自动更新!
if(!file_exists($objfile) || @filemtime($tpl.".htm") > @filemtime($objfile)) {
include_once(S_ROOT.'./source/function_template.php');
parse_template($tpl);
}
}
return $objfile;
}