最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php生成静态文件
时间:2008-04-24 编辑:简简单单 来源:一聚教程网
{
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 字符串检查类
-
下一个: php 获取图片尺寸
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24