$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成功
");
}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;
}
声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
相关文章
相关视频
全栈 100W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
入门 50W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
实战 80W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论