方便实用的PHP生成静态页面类非smarty第1/2页

WBOY
Freigeben: 2016-07-29 08:39:10
Original
1113 Leute haben es durchsucht

复制代码 代码如下:


/*********************/
/* */
/* 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教程有兴趣的朋友有所帮助。

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!