//打开模版文件 $file=fopen('temp.html','r'); $html_content=fread($file,filesize('temp.html')); //替换模版标签 $php_content=str_replace('{','<?php echo ',$html_content); $php_content=str_replace('}',';?>',$php_content); //新建php模版文件 $php_temp=fopen('temp.php','w'); fwrite($php_temp,$php_content); //赋值 $title='temp'; $content='temp'; include('temp.php');
转载于:https://www.cnblogs.com/masterRoshi/archive/2012/08/31/2665773.html