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();
?>
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!











