PHP generates a large number of HTML files, how to avoid memory exceeding
Ob_start ();
Require ' xxx.php ';
$temp = Ob_get_contents ();
Ob_end_clean ();
$fp = fopen ($path, ' w ');
Fwrite ($fp, $temp);
Fclose ($FP);
I'm now going to generate 10,000 data, loop through the code above, but prompt for memory out of the way, how to rewrite the program. (Do not modify memory, process from code)
In some CMS see is batch processing, generate HTML, and how to write?
------to solve the idea----------------------
Executed in batches, there is no question of what you said.
$total = 10;
$s = 0;
if (Isset ($_get [' s])) {
$s = &$_get [' s '];
}
$per = $s + 5; 5 strips per cycle
if ($per > $total) {//If the next loop will exceed the total, just let him loop to the total
$per = & $total;
}
while ($s < $per) {
echo + + $s;
Echo '
';
}
Echo ';
Echo $s;
if ($s < $total) {
echo "";
}