技术文章
当前位置:首页 > 技术文章

php生成html代码,php批量生成html文件

<?php session_start();include "./config.php";if(!$_SESSION["AmaoL0gined"]){header("location:login.php");exit; }
ini_set("max_execution_time", "1800");
$ico="";
$result=mysql_query("select * from web_site where belongid=8 and phpid=0 order by web_order ASC",$Conn);
while($row=mysql_fetch_array($result)) {
$webid=$row["webid"];
$web_url=trim($row["web_url"]);
switch($web_url){
case "/qualification.html":
$ico="qualification";
break;
case "/business.html":
$ico="business";
break;
default:
$ico="";
break;
}
$httpUrl_=$HttpHostAddress."/publish/web1.php?id=$webid&ico=$ico";
$filePaht_Name_="../".$web_url;
makehtml($httpUrl_,$filePaht_Name_);
}
//$httpUrl_=$HttpHostAddress."/publish/default.php";
//$filePaht_Name_="../default.html";
//makehtml($httpUrl_,$filePaht_Name_);

function makehtml($httpUrl,$filePaht_Name)
{
if(file_exists($filePaht_Name))
{
unlink($filePaht_Name);
}
$file_contents=file_get_contents($httpUrl);
$hp=fopen($filePaht_Name,'w');
fwrite($hp,$file_contents);
fclose($hp);
}
header("location:./message.php?action=makenew");exit;
?>