php生成静态文件路径|php生成静态文件

更新时间:2015-01-17    来源:代码生成    手机版     字体:

【www.bbyears.com--代码生成】

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()
 {
  $info     = ob_get_contents();
  $fileId   = """"12345"""";
  $postfix  = """".html"""";
  $path     = $this->mkdir($prefix= """"article"""");
  $fileName = time().""""_"""".$fileId.$postfix;
  $file=fopen($path.$fileName,""""w+"""");
  fwrite($file,$info);
  fclose($file);
  ob_end_flush();
 }
}
?>
$s=new CreateHtml();
$s->start();
?>


asdfasdfasdfasdfasdfasdfasdfasdfasdf

adfasdfasdf

>

$s->end();
?>
 

本文来源:http://www.bbyears.com/wangyetexiao/12274.html

猜你感兴趣

热门标签

更多>>

本类排行