位置:IT落伍者 >> php >> 浏览文章
[PHP]代码
<?php
/******************PHP静态类*************/
class
Shtml
{
var
$Templet
;
$DataSource
$Dir
$fileName
$mod
$handle
function
Shtml(
=
""
)
$this
>fileName =
>mod =
"wb"
>handle = false;
>Templet =
>DataSource =
array
();
>Dir =
}
// 绑定数据源参数为一数组
BindData(
$arr
// 设置文件存放路径
SetDir(
$dir
SetFileName(
return
GetMod()
>mod;
SetMod(
Open()
if
(
substr
>fileName ) ==
"/"
$_SERVER
[
DOCUMENT_ROOT
]
>fileName;
>handle =
fopen
>fileName
>mod))
>handle;
else
false;
Close()
fclose(
>handle);
Write(
$content
fwrite(
>handle
);
MkDir
$pathname
$currentPath
str_replace
$pathArr
= split(
[] ==
) {
//使用绝对路径
];
] dirname(
PHP_SELF
]);
for
$i
= ;
<
count
++) {
] ==
continue
is_dir
" / "
]))
mkdir
// 生成静态文件
Create()
$tmp
>Templet;
foreach
>DataSource
as
$key
=>
$value
" < FIELD_"
" > "
>
(dirname(
>fileName));
>Open();
>Write(
>Close();
CreateShtml() {
ob_start(
"callback_CteateShtml"
callback_CteateShtml(
$buffer
$page
intval
(@
$_REQUEST
"page"
$shtml
new
Shtml();
>SetFileName(
])
basename
"php"
) (
== ?
:
"_"
strval
))
"html"
>Create();
?>
上一篇:详解PHP会话存储方式
下一篇:解析php 版获取重定向后的地址(代码)