$fileName = md5_filename($rs[0],$rs['z_a'],$rs['filesendid']);
$path = get_path($rs['sysa']).$rs['z_a'].'/';
$parent = $_SERVER["DOCUMENT_ROOT"];//substr(getcwd(),0,strrpos(getcwd(),'\'));
$filePath = $parent.'\'.$path;
$tempLate = str_replace('{path}',path($rs['z_a'],$rs['sysa']),$fileContent);
$tempLate = str_replace('{htmlAbout}',htmlAbout($rs['z_a'],10,8,0,''),$tempLate);
$tempLate = str_replace('{htmlTemplate}',htmlTemplate(0),$tempLate);
$tempLate = str_replace('{htmlMenu}',htmlMenu($rs['sysa']),$tempLate);
$tempLate = str_replace('{htmlHelp}',htmlHelp($rs['sysa']),$tempLate);
$tempLate = str_replace('{htmlNews}',htmlAbout($rs['z_a'],0,8,0,''),$tempLate);
$tempLate = str_replace('{htmlHot}',htmlAbout($rs['z_a'],0,8,1,''),$tempLate);
$tempLate = str_replace('{htmlSoure}',htmlTemplate(1),$tempLate);
$tempLate = str_replace('php簡單生成html靜態頁面代碼',$rs['title'],$tempLate);
$tempLate = str_replace('{htmlContent}',$rs['content'],$tempLate);
$tempLate = str_replace('{description}',$rs['description'],$tempLate);
$tempLate = str_replace('{keywords}',$rs['keywords'],$tempLate);
makeHtml($tempLate,$filePath,$fileName);
function makeHtml($msgContent,$filePath,$fileName){//生成html文件
if(!is_dir($filePath)){@mkdir($filePath);}
//die($filePath);
$handle = fopen(str_replace('\','../',$filePath.$fileName),'w+') or die("can't create file!$fileName");
fwrite($handle,$msgContent);
fclose($handle);
}
本站原創轉截注明:www.111cn.net/phper/php.html