方便實用的PHP產生靜態頁麵類別非smarty第1/2頁

WBOY
發布: 2016-07-29 08:39:10
原創
1113 人瀏覽過

複製程式碼 程式碼如下:


/*********************/
/* */
/* Version : 5.2.5 */
/* Author : liqiangwork#sohu.com */
/* QQ : 570937581 */
/* */
/*********************/
//-----------------------------產生靜態的類別-------------- -----------------
class Makehtml{
public $MbUrl,$OutUrl,$AllHtml,$SouChar,$ObjChar; //變數
public $ row; //遊標
public $Shuzusou,$Shuzuobj; //替換的字串陣列
//-----------------------初始化-------------------------
function __construct(){ //初始化
$this->MbUrl="";
$this->OutUrl="";
$this->AllHtml="";
$this->Sql="";
$this->SouChar="";
$this->ObjChar="";
}
//-----------------------------自動按字段替換---------------------------
function AutoReplace(){
//--------- ---------自動取得要替換的字串-------------------
$tlen=count($row);
$shuzu1=array();
$shuzu2=array();
if($row){
$i=0;
foreach($row as $key => $value){
$shuzu2[i]="";
$shuzu1[i]=$value;
$i++;
}
$this ->Replacehtml(shuzu2,shuzu1);
}
//------------------自動取得要替換的字串------- ------------
}
//-----------------------------自動以欄位取代完成------------------------
//---------------- -------------批次替換陣列--------------------------
function Replacehtml($Shuzusou ,$Shuzuobj){ //批次替換數組
if(count($Shuzusou)!=count($Shuzuobj)){
exit("替換數組不符");
}
if ($this->AllHtml==""){
exit("沒有要替換的內容");
}
for($i=0;$i$this->AllHtml=str_replace($Shuzusou[$i],$Shuzuobj[$i],$this->AllHtml);
//print("
".$Shuzusou (i)."=".$Shuzuobj(i)."
")
}
}
//----------------- ------------批量替換數組完成--------------------------
//--- --------------------------讀取檔案--------------------------------- ------------
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);
}
//------------------ -----------儲存檔案完成------------------------------
}
//------------------------------產生靜態的類別完成------------ -------------------


相關實例:

目前1/2頁 12下一頁

以上就介紹了 方便實用的PHP生成靜態頁類非smarty第1/2頁,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!