Regularly generate static pages (PHP and ASP)

Source: Internet
Author: User
Regularly generate static pages (PHP and ASP)
Usage: when the website traffic is high, you can call the above code on the homepage using iframe, such as inserting
Reprint address: http://blog.qita.in /? Posting = 327

  1. Most of the time, we need to use the function of generating html pages on a regular basis. The principle is to compare the last modification time of a file, such as index.html, with the current time. when the time difference exceeds a certain interval, for example, 2 hours, call the relevant page to generate a new page. The source code is as follows.
  2. On the regular Generation page of the PHP version:
  3. $ File = dirname (_ FILE _). '/index.html ';
  4. $ Timex = time ()-filemtime ($ file); // interval, in seconds
  5. If ($ timex> 7200) {// interval greater than 2 hours, regenerate
  6. 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.