複製程式碼 程式碼如下:
class Shtml
{
var $Templet;
var $ var $mod;
var $handle;
function Shtml($fileName="")
{
$this->fileName=$fileName; > $this->handle=false;
$this->Templet = "";
$this->DataSource = array();
///
/// 綁定資料來源,參數為一數組。
/// 描述>
function BindData($arr)
{
$ > /// 設定文件存放路徑。
/// 描述>
function SetDir($dir)
{
$this->
{
return $this->fileName=$fileName;
}
function GetMod()
function SetMod( $mod)
{
return $this->mod=$mod;
}
function Open) 1)=="/")
$this->fileName = $_SERVER['DOCUMENT_ROOT'] . $this->fileName;
if($this->handle=fopen($this-this> $this->mod))
return $this->handle;
else
return false; handle);
}
function Write($content)
{
return fw name )
{
$currentPath="";
str_replace("","/",$pathname);
$pathArr ($pathArr[0] == "") //使用絕對路徑
{
$currentPath = $_SERVER['DOCUMENT_ROOT']; $ currentPath = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']);
}
for($i=0; $i
continue;
else
if(is_ > $currentPath = $currentPath . "/" . $pathArr[$i];
else
mkdir($currentPath = $currentPath . "/" . $pathArr[$i]);
}
}
///
/// 產生靜態檔案。
/// 描述>;
函數 Create()
{
$tmp = $this->Templet;
foreach($this->DataSource as $key=>$value)
{
$tmp = str_replace("
$this->MkDir(dirname($this->fileName));
$this->Open(); Close();
}
}
函數CreateShtml()
{ callback_CteateShtml($buffer)
{
$page = intval(@$_REQUEST["page"]);
$shtml = new Shtml(); 名稱($_SERVER['PHP_SELF']) . "/" . 基本名稱($_SERVER['PHP_SELF'],".php") . ( $page==0 ?「」 「_」 . strval($page) ) . 「.htm」);
$shtml->範本 = $buffer;
$shtml->Create();
返回$b?;
以上就介紹了http://67.220.92.21/forum/inde PHP靜態類,包括了http://67.220.92.21/forum/inde方面的內容,希望對PHP有教程興趣的朋友有所幫助。 >