PHP regularly generates static HTML implementation code _ PHP-php Tutorial

Source: Internet
Author: User
To speed up website access, we often use static generation methods to achieve this, which indeed improves the website access speed a lot. however, regular generation has some limitations. if you have an independent server, you can set scheduled tasks on the server. However, if you use a virtual host, it is not easy to do. although there are many methods. however, it is easy to use. I think it is easier to determine the difference between the generation time of the generated homepage file and the existing time. if a value is satisfied, it is easier to generate this method. not much. start!

Remember what I found online. Proven to be available.
The code is as follows:
$ Nowtime = time ();
$ Pastsec = $ nowtime-$ _ GET ["t"];

If ($ pastsec <60)
{
Exit; // update once every 1 minute. the time can be adjusted by yourself.
}

Ob_start (); // open the buffer
Include ("index. php ");
$ Content = ob_get_contents (); // Obtain the buffer content.
$ Content. = "n

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.