最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP靜態(tài)類

 更新時(shí)間:2006年11月25日 00:00:00   作者:  

復(fù)制代碼 代碼如下:
<?php  
class Shtml  
 {  
 var $Templet;  
 var $DataSource;  
 var $Dir;  

 var $fileName;  
 var $mod;  
 var $handle;  

 function Shtml($fileName="")  
 {  
 $this->fileName=$fileName;  
 $this->mod="wb";  
 $this->handle=false;  

 $this->Templet = "";  
 $this->DataSource = array();  
 $this->Dir = "";  
 }  

 /// <描述>  
 /// 綁定數(shù)據(jù)源,參數(shù)為一數(shù)組。  
 /// </描述>  
 function BindData($arr)  
 {  
 $this->DataSource = $arr;  
 }  

 /// <描述>  
 /// 設(shè)置文件存放路徑。  
 /// </描述>  
 function SetDir($dir)  
 {  
 $this->Dir = $dir;  
 }  
 function SetFileName($fileName)  
 {  
 return $this->fileName=$fileName;  
 }  

 function GetMod()  
 {  
 return $this->mod;  
 }  
 function SetMod($mod)  
 {  
 return $this->mod=$mod;  
 }  
 function Open()  
 {  
 if(substr($this->fileName,0,1)=="/")  
 $this->fileName = $_SERVER['DOCUMENT_ROOT'] . $this->fileName;  
 if($this->handle=fopen($this->fileName, $this->mod))  
 return $this->handle;  
 else  
 return false;  
 }  
 function Close()  
 {  
 return fclose($this->handle);  
 }  
 function Write($content)  
 {  
 return fwrite($this->handle,$content);  
 }  
 function MkDir($pathname)  
 {  
 $currentPath="";  
 str_replace("\","/",$pathname);  
 $pathArr = split("/",$pathname);  
 if($pathArr[0] == "") //使用絕對(duì)路徑  
 {  
 $currentPath = $_SERVER['DOCUMENT_ROOT'];  
 }  
 else  
 {  
 $currentPath = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']);  
 }  
 for($i=0; $i<count($pathArr); $i++)  
 {  
 if($pathArr[$i]=="")  
 continue;  
 else  
 if(is_dir($currentPath . "/" . $pathArr[$i]))  
 $currentPath = $currentPath . "/" . $pathArr[$i];  
 else  
 mkdir($currentPath = $currentPath . "/" . $pathArr[$i]);  
 }  
 }  

 /// <描述>  
 /// 生成靜態(tài)文件。  
 /// </描述>  
 function Create()  
 {  
 $tmp = $this->Templet;  
 foreach($this->DataSource as $key=>$value)  
 {  
 $tmp = str_replace("<FIELD_" . $key . ">", $value, $tmp);  
 }  
 $this->MkDir(dirname($this->fileName));  
 $this->Open();  
 $this->Write($tmp);  
 $this->Close();  
 }  
 }  

 function CreateShtml()  
 {  
 ob_start("callback_CteateShtml");  
 }  
 function callback_CteateShtml($buffer)  
 {  
 $page = intval(@$_REQUEST["page"]);  
 $shtml = new Shtml();  
 $shtml->SetFileName($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . "/" . basename($_SERVER['PHP_SELF'],".php") . ($page==0 ? "" : "_" . strval($page)) . ".htm");  
 $shtml->Templet = $buffer;  
 $shtml->Create();  
 return $buffer;  
 }  
?>

相關(guān)文章

最新評(píng)論

城步| 册亨县| 宣威市| 翼城县| 嘉善县| 莆田市| 法库县| 陵水| 建平县| 明溪县| 舟曲县| 兴城市| 岳池县| 和硕县| 卫辉市| 虹口区| 宜阳县| 扎赉特旗| 新津县| 襄垣县| 错那县| 江孜县| 富锦市| 河北区| 蒙城县| 周口市| 丘北县| 连州市| 松潘县| 嘉善县| 新泰市| 兴义市| 鄂州市| 石狮市| 辽中县| 辽阳市| 尉犁县| 图片| 正宁县| 德清县| 渑池县|