複製程式碼 程式碼如下:
class Shtml
{
var $Templet;
var $
var $mod;
var $handle;
function Shtml($fileName="")
{ $this->fileName=$Name- "wb";
$this->handle=false;
$this->Templet = "";
$ Dir = "";
}
///
/// 綁定資料來源,且參數為一數組。
/// 描述>
function BindData($arr)
{
$ >
/// 設定檔案存放路徑。
/// 描述>
function SetDir($dir)
{
$this->
{
return $this->fileName=$fileName;
}
function GetMod()
function SetMod($mod)
{
return $this->mod=$mod;
}
functionthis ,0,1)=="/")
$this->fileName = $_SERVER['DOCUMENT_ROOT'] . $this->fileName;
if($this->handle=fopen($this-fopen($this- >fileName, $this->mod))
return $this->handle;
else
return false; 🎜> return fclose ($this->handle);
}
function Write($content)
{
return fwrite($this->handle,$content);
}
function MkDir ($pathname)
{
$currentPath="";
str_replace("","/",$pathname);
🎜> if($pathArr[0] == "") //使用絕對路徑
{
$currentPath =
$currentPath = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']);
} {
if($pathArr[$i]=="")
continue;
else )
$currentPath = $currentPath . "/" . $pathArr[$i];
else
mkdir($currentrent 🎜 > }
}
///
/// 產生靜態檔案。
/// 描述>;
函數 Create()
{
$tmp = $this->Templet;
foreach($this->DataSource as $key=>$value)
{
$tmp = str_replace(" }
$this->MkDir(dirname($this->fileName));
$this->Open(); Close();
}
}
函數CreateShtml()
🎜> 函數callback_CteateShtml($緩衝區)
{
$page = intval(@$_REQUEST["page"]);
$shtml = new Shtml(); ') ] . 目錄名($_SERVER['PHP_SELF']) . "/" . 基本名稱($_SERVER['PHP_SELF'],".php") . ( $page==0 ?“”: “_ “_” . strval($頁)) . 「.htm」);
$shtml->Templet;
$shtml->Create();
http://www.bkjia.com/PHPjc/317057.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/317057.html
TechArticle
複製程式碼如下: ?php classShtml { var$Templet; var$ 資料來源; var$目錄; var$檔名; var$mod; var$句柄; functionShtml($fileName="") { $this-fileName=$fileName; $這個-...