php 静态文件生成类

?phpclass 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(); }}??php$s=new
CreateHtml();$s-start();?htmlbodyasdfasdfasdfasdfasdfasdfasdfasdfasdfbradfasdfasdfbr/body/html?php$s-end();?

发表评论

电子邮件地址不会被公开。 必填项已用*标注