Home > php教程 > php手册 > PHP生成静态页

PHP生成静态页

WBOY
Release: 2016-06-13 12:35:56
Original
927 people have browsed it

复制代码 代码如下:

  
 function makedir($mudir) //创建目录 
 { 
 $file = "./$mudir"; 
 @mkdir($file,0777); 
 } 
 function writemod($filemodname)   //先创子摸板文件路径 
 { 
  $fp=fopen("showmod.shtml","r"); 
  $str=fread($fp,filesize("showmod.shtml")); 
  fclose($fp); 
  $fp=fopen($filemodname,"w"); 
  fwrite($fp,$str); 
  fclose($fp); 
 } 
 function writeweb($content,$web,$modfile) //更新各自的子摸板文件//$modfile是子摸板名字 
 { 
 $fp=fopen($modfile,"r"); 
 $str=fread($fp,filesize($modfile)); 
 $str=str_replace($content,$web,$str); 
 fclose($fp); 
 $fp = fopen($modfile,"w"); 
 fwrite($fp,$str); 
 fclose($fp); 
 } 
 $m = "00000"; 
 makedir($m); 
 $ff = $m."/0001.shtml"; 
 if(!file_exists($ff)) 
 { 
 writemod($ff); 
 } 
 else 
 { 
  echo"已经存在"; 
 } 
 $d="{content6}"; //被更新的内容 
 $dd="";//要更新的内容//要更新的内容 
 @writeweb($d,$dd,$ff); 
?>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template