<?php
$template_file = "template_art.html";
if( file_exists($template_file) ){
$mb = file_get_contents($template_file);
if( !empty($mb) ){
for( $i=1;$i<=100;$i++) {
$temp = makehtml($mb);
$handle = fopen($i.".html",'w+');
if( fwrite($handle,$temp)){
echo("创建文件$i.html成功<br>");
}else{
echo('文件不可写状态!');
}
}
fclose($handle);
}else{
die('read template fail');
}
}else{
die('Template file not exists');
}
function makehtml($str){
$array = array('{dxh}menu{/dxh}','{dxh}content{/dxh}','{dxh}hot{/dxh}','{dxh}down{/dxh}','{dxh}help{/dxh}','{dxh}school{/dxh}');
$Rarray = array('菜单','内容','热点','下载','帮助','学院');
$str = str_replace($array,$Rarray,$str);
return $str;
}
时间: 2024-09-19 09:46:33