时间:2021-07-01 10:21:17 帮助过:7人阅读
require "system/system.php";
$tpl = new KSeeing();
$tpl->assign("show",'success');
$show = '111';
include('templates/index.html'); =======================这样写的话 $show能成功赋值
//include('F:/AppServ/www/temp/tpl/com_index.html.php');
//$tpl->compile('index.html');===================这样写的话$show不能赋值
?>
function compile($fileName){
$ducument_root = $_SERVER['DOCUMENT_ROOT'];
$tplFile = $ducument_root.$this->template_dir.$fileName; //找到模版文件
if(!file_exists($tplFile)){
return false;
}
$comFile = $ducument_root.$this->compile_dir.'com_'.basename($tplFile).'.php';//构造编译后的文件
if(!file_exists($comFile) || filemtime($comFile)$repContent = $this->tpl_replace(file_get_contents($tplFile));//获取源文件内容并替换成php源格式
$handle = fopen($comFile,'w+');
fwrite($handle,$repContent);
fclose($handle);
}
include($comFile);
}
extract($this->data);
include($comFile);