打包
下载
Pain.php
var[$variable]=$value; } public function display($template_name,$return_string=false) { //first find whether the tmp file in tmp dir exists. if(file_exists("tmp/temp_file.php")) { unlink("tmp/temp_file.php"); } extract($this->var); $tpl_content=file_get_contents($template_name); $tpl_content=str_replace("{@", "", $tpl_content); //create a file in the /tmp dir and put the $tpl_contentn into it, then //use 'include' method to load it! $tmp_file_name="temp_file.php"; //$tmp is the handler $tmp=fopen("tmp/".$tmp_file_name, "w"); fwrite($tmp, $tpl_content); include "tmp/".$tmp_file_name; } } ?>
test.php
assign("songyu",$songyu); $pain->assign("zhangyuan",$zhangyuan); $pain->display("new_file.html"); ?>
new_file.html
new_file {@$songyu@}
{@$zhangyuan@}