欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

方便實(shí)用的PHP生成靜態(tài)頁(yè)面類(非smarty)第1/2頁(yè)

 更新時(shí)間:2008年11月14日 12:25:17   作者:  
不喜歡Smarty,直接寫了一個(gè)生成靜態(tài)的類,方便簡(jiǎn)單實(shí)用,希望大家繼續(xù)完善。
復(fù)制代碼 代碼如下:

/*********************/
/* */
/* Version : 5.2.5 */
/* Author : liqiangwork#sohu.com */
/* QQ : 570937581 */
/* */
/*********************/
//-----------------------------生成靜態(tài)的類-------------------------------
class Makehtml{
public $MbUrl,$OutUrl,$AllHtml,$SouChar,$ObjChar; //變量
public $row; //游標(biāo)
public $Shuzusou,$Shuzuobj; //替換的字符串?dāng)?shù)組
//-----------------------初始化-------------------------
function __construct(){ //初始化
$this->MbUrl="";
$this->OutUrl="";
$this->AllHtml="";
$this->Sql="";
$this->SouChar="";
$this->ObjChar="";
}
//-----------------------------自動(dòng)按字段替換---------------------------
function AutoReplace(){
//------------------自動(dòng)獲取要替換的字符串-------------------
$tlen=count($row);
$shuzu1=array();
$shuzu2=array();
if($row){
$i=0;
foreach($row as $key => $value){
$shuzu2[i]="<=\$".$key."\$>";
$shuzu1[i]=$value;
$i++;
}
$this->Replacehtml(shuzu2,shuzu1);
}
//------------------自動(dòng)獲取要替換的字符串-------------------
}
//-----------------------------自動(dòng)按字段替換完成------------------------
//-----------------------------批量替換數(shù)組--------------------------
function Replacehtml($Shuzusou,$Shuzuobj){ //批量替換數(shù)組
if(count($Shuzusou)!=count($Shuzuobj)){
exit("替換數(shù)組不匹配");
}
if($this->AllHtml==""){
exit("沒有要替換的內(nèi)容");
}
for($i=0;$i<count($Shuzusou);$i++){
$this->AllHtml=str_replace($Shuzusou[$i],$Shuzuobj[$i],$this->AllHtml);
//print("<br>".$Shuzusou(i)."=".$Shuzuobj(i)."<br>")
}
}
//-----------------------------批量替換數(shù)組完成--------------------------
//-----------------------------讀取文件---------------------------------
function Readfile(){
$file=fopen($this->MbUrl,"r");
$fsize=filesize($this->MbUrl);
$this->AllHtml=fread($file,$fsize);
fclose($file);
}
//-----------------------------讀取文件完成------------------------------
//-----------------------------保存文件---------------------------------
function SaveFile(){
$file=fopen($this->OutUrl,"w");
fwrite($file,$this->AllHtml);
fclose($file);
}
//-----------------------------保存文件完成------------------------------
}
//------------------------------生成靜態(tài)的類完成-------------------------------

相關(guān)實(shí)例:

相關(guān)文章

最新評(píng)論