Developed for the cd2sc.com website function, the code is self-generated and the generation speed is average.
(For a well-known reason, the data field name involved in the database has been changed, and the parameter filtering is removed for the sake of code Clarity)
Note: The original Dynamic Address is moban. php? Id = 1. The generated URL is html/200808/sell_1.html. Page. php is a paging program, which has been released in this blog.
Page usage: save this code as make. php. How can I access make. php in a browser? T = quantity & pg = page; for example, make. php? T = 300 & pg = 2, that is, 300 pieces of data are generated each time, starting from page 1 of the Data list, that is, the first 2nd pieces are skipped. If you directly access make. php without adding any parameters, 200 entries are generated each time by default, starting from the first page.
Copy codeThe Code is as follows:
<? Php
If ($ _ GET [pg] = ''){
$ Aa = 1;
} Else {
$ Aa = $ _ GET [pg];
}
Include ("admin/conn. php ");
Require_once ("page. php ");
$ Result = mysql_query ("select * from 2 cartid ");
$ Totle = mysql_num_rows ($ result );
$ Pagelist = $ _ GET [t];
If ($ _ GET [t] = ''){
$ Pagelist = '20140901 ';
} Else {
$ Pagelist = $ _ GET [t];
}
$ Pager = new Pager ($ totle, $ pagelist );
$ Datastat = "Total <B> ". $ pager-> countall. "</B>, generated each time <B> ". $ pager-> countlist. "</B>, which must be generated <B> ". $ pager-> page. "</B> times"; // data statistics
$ Bb = $ pager-> page;
$ Pagenav = $ pager-> backstr. $ pager-> thestr. $ pager-> nextstr;
$ LimitFrom = $ pagelist * ($ pager-> pg-1 );
$ Result = mysql_query ("select * from 2 carrentorder BY id DESC limit $ limitFrom, $ pagelist ");
?>
<Center> <div style = "font-size: 14px;"> <B> NO. <font color = red> <? Echo $ aa?> </Font> page generation... <? Echo $ datastat?> </B> </div> <br>
<?
Print "<center> <textarea name = textarea class = textarea style = 'width: 520px; height: 455px '> ";
While ($ datauser = mysql_fetch_array ($ result )){
$ Iid = $ datauser [id];
$ Html = file_get_contents ("/moban. php? Id = ". $ iid ."");
$ SQL = "select * from 2 cartid where id = $ iid ";
$ Data = mysql_fetch_array (mysql_query ($ SQL ));
$ Path = date ("Ym", $ data [PutDate]);
$ Testdir = "html/". $ path;
If (file_exists ($ testdir )):
Else:
Mkdir ($ testdir, 0777 );
Echo "directory". $ testdir. "created successfully! <Br> ";
Endif;
$ Filename = "html/$ path/sell_$iid.html ";
// Enable $ filename in write mode
If (! $ Handle = fopen ($ filename, 'w ')){
Print "the file $ filename cannot be opened ";
Exit;
}
If (is_writable ($ filename )){
// Write $ html into the open file.
If (! Fwrite ($ handle, $ html )){
Print "cannot be written to file $ filename ";
Exit;
}
Print "File $ filename updated successfully! \ N \ r ";
Fclose ($ handle );
} Else {
Print "File $ filename cannot be written ";
}
?>
<? }?>
</Textarea>
<Br>
<Div style = "font-size = 12px"> <? Echo $ datastat. ""?> </Div> <br>
<?
$ Aa = $ aa + 1;
If ($ aa> $ bb ){
Echo '<font color = blue> congratulations, all pages have been generated! </Font> ';
Echo "<script> alert ('All documents have been generated/updated! ') </Script> ";
} Else {
Echo "<Script> window. location = 'make. php? T = $ pagelist & pg = $ aa '; </script> ";
}
?>