PHP generates a large number of HTML files, how to handle memory beyond

Source: Internet
Author: User
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 "";
}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.