sdfsdf.php
<?php
$html= '<b>sdfsdfsdfsfsd dfsdfsdkflsdf .</b>';
$file = dirname(__FILE__).'/tpl.htm';
$a = 1;
if(file_exists($file)){
ob_start();
require_once($file);
$message = ob_get_contents();
ob_end_clean();
}
//echo $message;
$file_par = "./tpl.html";
$content = fopen($file_par,"a");
fwrite($content,$message);
fclose($content);
echo "已经生成静态文件tpl.html";
?>
tpl.htm
<?php
echo 'this is '.$html;//可以直接显示变量$html
if ($a){
echo 'a is true';//执行逻辑的例子
}
?>