Home  >  Article  >  Backend Development  >  PHP

PHP

WBOY
WBOYOriginal
2016-07-20 11:08:261316browse

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}>






http://www.bkjia.com/PHPjc/444874.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/444874.htmlTechArticlephp鐢熸垚闱欐€侀〉闱窭佹湰娆 drama擓鎴愰run鐐侀〉闱㈢▼搴忓焄鐜综合师鐞嗘槸屋橩ソ镊畾鄄勬ā鏉掎爣绛璅纴鐒莗鐢深tr_replace鎶婃爣磛综合浛鎹㈡垚鎸囧畾镄嫫崴簸纴鍐敱敱fopen鐢熸垚鸸囧畾...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn