php 生成html文件代码

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

php 生成html文件代码的相关文章

5种php生成swf 文件代码

/* 下面这几款php生成flash文件代码,是从简单的生成swf文件到生成 flash动画文件等,每个实例都是经典的. */ //首先开启php扩展php_ming $f = new swffont( '_sans' ); $t = new swftextfield(); $t->setfont( $f ); $t->setcolor( 0, 0, 0 ); $t->setheight( 400 ); $t->addstring( 'hello world' ); $m = ne

php生成pdf文件代码(1/12)

<? //php教程生成pdf文件代码 /* 生成pdf文件如果真的生成很好,是很复杂的,下面我们来看看一款完整理的php生成pdf文件代码吧,他可以把文本文件生成pdf文件也可以利用图片文件生成pdf文件哦. 这款生成pdf文件用到文件有 fpdf.php chinese.php picpdf.php */ //fpdf.php代码 define('fpdf_version','1.6'); class fpdf { var $page;               //current pag

利用Python 脚本生成 .h5 文件 代码

利用Python 脚本生成 .h5 文件  1 import os, json, argparse 2 from threading import Thread 3 from Queue import Queue 4 5 import numpy as np 6 from scipy.misc import imread, imresize 7 import h5py 8 9 """ 10 Create an HDF5 file of images for training

asp生成xml文件代码

 代码如下 复制代码 <!--#include file="config.asp"--> <% Dim Rs,SQL,foundstr Dim classid,ChildStr Dim RssBody,RssTitle,RssHomePageUrl Dim XMLDOM,node,Cnode,Cnode1,msginfo Set XMLDOM = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")

asp.net生成csv文件代码

using system.web; public class sdsavecsv {         /// <summary>         /// 构造函数         /// </summary>         /// <param name="response">httpresponse对象</param>         public sdsavecsv(httpresponse response)         {

php生成html文件代码

 ,下面我们来看看 第一种方法:就是用smary的模板来生成. require('smarty/Smarty.class.php'); $t = new Smarty; $t->assign("title","Hello World!"); $content = $t->fetch("templates/index.htm"); //这里的 fetch() 就是获取输出内容的函数,现在$content变量里面,就是要显示的内容了 $f

菜鸟求助~VB.net将listview生成htm文件代码怎么写?

问题描述 rt有点着急啊...各位帮帮忙吧我是菜鸟,基础不是很扎实,希望各位帮忙解决一下.. 解决方案 解决方案二:你用设计模式,直接把listview拖到页面上,不是就有html框架了吗,你可以直接改里面的模板呀解决方案三:把什么改成设计模式?话说我真的是很菜啊...求详细指导

asp 生成feed文件代码

<% function AddSiteURL(ByVal Str)   If IsNull(Str) Then    AddSiteURL = ""    Exit Function   End If   Dim re   Set re=new RegExp   With re     .IgnoreCase =True     .Global=True         .Pattern="<img (.*?)src=""(?!(http|ht

asp生成静态文件代码

<% Dim Rs,SQL,HtmlContent Dim ChannelRootDir,strInstallDir,strIndexName Dim flashid,downid,showurl,ErrMsg Dim strTitle,strAddress,addTime Dim AllHits,Introduce,filesize Dim HtmlFileUrl,HtmlFileName,strUrl Newasp.ReadChannel(ChannelID) ChannelRootDir