Copy CodeThe code is as follows:
/*********************/
/* */
/* version:5.2.5 */
/* author:liqiangwork#sohu.com */
/* qq:570937581 */
/* */
/*********************/
-----------------------------generate a static class-------------------------------
Class makehtml{
Public $MbUrl, $OUTURL, $AllHtml, $SouChar, $ObjChar; Variable
Public $row; Cursor
Public $Shuzusou, $Shuzuobj; Array of strings replaced
-----------------------initialization-------------------------
function __construct () {//initialization
$this->mburl= "";
$this->outurl= "";
$this->allhtml= "";
$this->sql= "";
$this->souchar= "";
$this->objchar= "";
}
-----------------------------automatically replaced by fields---------------------------
function Autoreplace () {
------------------automatically gets the string to replace-------------------
$tlen =count ($row);
$shuzu 1=array ();
$shuzu 2=array ();
if ($row) {
$i = 0;
foreach ($row as $key = = $value) {
$shuzu 2[i]= "<=\$". $key. " \$> ";
$shuzu 1[i]= $value;
$i + +;
}
$this->replacehtml (SHUZU2,SHUZU1);
}
------------------automatically gets the string to replace-------------------
}
-----------------------------is automatically replaced by field------------------------
-----------------------------Bulk Replace Array--------------------------
function replacehtml ($Shuzusou, $Shuzuobj) {//Bulk replace array
if (count ($Shuzusou)!=count ($Shuzuobj)) {
Exit ("Replace array mismatch");
}
if ($this->allhtml== "") {
Exit ("No content to replace");
}
for ($i =0; $i $this->allhtml=str_replace ($Shuzusou [$i], $Shuzuobj [$i], $this->allhtml);
Print ("
". $Shuzusou (i)." = ". $Shuzuobj (i)."
")
}
}
-----------------------------Bulk Replace array complete--------------------------
-----------------------------Read Files---------------------------------
function Readfile () {
$file =fopen ($this->mburl, "R");
$fsize =filesize ($this->mburl);
$this->allhtml=fread ($file, $fsize);
Fclose ($file);
}
-----------------------------Read File Completion------------------------------
-----------------------------Save the file---------------------------------
function SaveFile () {
$file =fopen ($this->outurl, "w");
Fwrite ($file, $this->allhtml);
Fclose ($file);
}
-----------------------------Save file Complete------------------------------
}
------------------------------generate a static class completion-------------------------------
Related examples:
http://www.bkjia.com/PHPjc/319586.html www.bkjia.com true http://www.bkjia.com/PHPjc/319586.html techarticle Copy the code as follows:/*********************//* */* version:5.2.5 *//* author:liqiangwork#sohu.com *//* qq:570937581 * / /* */ /*********************/ //------------...