【www.gdgbn.com--php函数】

class CreateHtml{
 /*function mkdir($prefix= "article" ){
  $y = date("Y");
  $m = date("m");
  $d = date("d");
  $p=DIRECTORY_SEPARATOR;
  $filePath="article".$p.$y.$p.$m.$p.$d;
  $a=explode($p,$filePath);
  foreach ($a as $dir){
   $path.=$dir.$p;
   if(!is_dir($path)){         //echo "没有这个目录".$path;
    mkdir($path,0755);
   }
  }
  return $filePath.$p; 
 }*/
 
 function start(){
  ob_start();
 }
 
 function end($name){
  $info     = ob_get_contents();
  $fileId   = $name;
  $postfix  = ".html";
  //$path     = $this->mkdir($prefix= "article");
  $fileName = $fileId.$postfix;
  //$file=fopen($path.$fileName,"w+"); 
  $file=fopen($fileName,"w+");
  fwrite($file,$info);
  fclose($file);
  ob_end_flush();
 }
 
}
?>

本文来源:http://www.gdgbn.com/jiaocheng/23705/