Ec (2); $ tmpBody & quot; fjka; fjsa; {page}: generate batch file splitting and add paging code & quot; & nbsp; & nbsp; $ tmpUrlwww.111cn.net; & nbsp; $ tmpUrlarrayexplode (., $ url) script ec (2); script
$ TmpBody = "fjka; fjsa; {page}: generate multiple files and add paging code ";
$ TmpUrl = 'www .111cn.net ';
$ TmpUrlarray = explode ('.', $ url );
$ TmpArray = explode ('{page}', $ tmpBody );
$ Total = count ($ tmpArray );
If ($ total> 1)
{
$ TmpStr = '';
For ($ I = 0; $ I <$ total; $ I ++) // traverses all pages
{
If ($ I = 0)
{
$ Str. = "'. ($ I + 1 ).'';
}
Else
{
$ Str. = "'. ($ I + 1 ).'';
}
}
// Generate files in batches and add paging code
$ Str ='
'. $ Str .'
';
For ($ j = 0; $ j <$ total; $ j ++)
{
If ($ j = 0)
{
$ Fname should contain rsw.'id'{.'.htm ';
}
Else
{
$ Fname should contain rsw.'id'}.'_'.w.j.'.htm ';
}
$ TempMu = str_replace ('{htmlContent}', $ tmpArray [$ j]. $ str, $ tempLate );
MakeHtml ($ tempMu, $ filePath, $ fname); // The code for creating a file is not described in this function.
}
$ Mupage = 1;
}
$ TempLate = str_replace ('{htmlContent}', $ tmpBody, $ tempLate); // common articles are retrieved by {page} and saved to an array to generate a paging address, then, the htm page is generated based on the content of the explode array. The source www.111cn.net is reproduced in the original tutorial on this site.
$ Total = 0;
$ Str = '';
$ I = 0;
$ J = 0;
/*
The origin of the Code is the id_page number, such as 100_1.htm,100_2.htm.
*/
?>