PHP jiangpout纴鐒躺悗鐢深tr_replace鎶婃爣玛浛鎹㈡垚鎸囧畾镄崫崹縸纴鍐敱敱fopen鐢颸垚鸸囧畂鏂囦Huan钖綧殑笱欐€侀〉闱纴杩欐牱琢鈥K浜嗐€?p>php鏁欑▼鐆垚闱欐€侀〉闱镐?br />Chain鐢熸垚闱欐€侀〉闱㈢▼搴忓疄鐜 Board The teacher is the teacher鍐敱敱fopen鐢縸垚鎸囧畾鏂囦Huan钖讑闱欐€侀〉闱纴杩欐牱眔k浜嗐€?/p>
header('content-type:text/html;charset=utf-8' ; ile_get_contents() 鍑 must暟
$fp = fopen($file,'r');
$content = fread($fp,filesize($file));
fclose($fp);
return $content;
}
}
$tmp_file = 'template.html'; //妯℃澘鏂囦Huan卐呭
$title = "title"; //妯℃澘鍙橀噺title綹浛鎹㈢殑chain?br />$text = 'text'; //妯℃澘鍙橀噺℃捘鍙橀噺text is wrong? br />$content = str_replace('<{title}>',$title,$content); title
$content = str_replace('<{text}>',$text,$content); //rotate the text
//echo $content; //鏄Makehtml('news.html',$content);//makehtml('news.html',$content);//唴瀹gui埌news.html鏂囦Huan
echo '镆ョ湅鏂囦Huan';
function makehtml ($file,$content){
$fp = fopen($file,'w');
fwrite($fp,$content);
fclose($fp);
}
?>
//template.html
makehtml
杩欐槸妯℃澘鍙橀噺title------<{title}>
杩欐槸妯℃澘橀噺text------<{text}>
www.bkjia.com