Home  >  Article  >  Backend Development  >  Generate static pages regularly (PHP and ASP versions)

Generate static pages regularly (PHP and ASP versions)

WBOY
WBOYOriginal
2016-07-25 09:02:181220browse
Generate static pages regularly (PHP and ASP versions) How to use: On pages with high traffic on the website, usually the homepage, use iframe to call the above code, such as inserting
Reprint address: http://blog.qita.in/?post=327
  1. Many times, we need to use the function of regularly generating html pages. Brief introduction to the principle: Compare the last modification time of files such as index.html with the current time. When the time difference exceeds a certain interval such as 2 hours, call the relevant page to generate a new page. The original source code is below.
  2. PHP version of scheduled page generation:
  3. $file = dirname(__FILE__).'/index.html';
  4. $timex=time()-filemtime($file); //Interval time , unit second
  5. if($timex>7200){ //If the interval is greater than 2 hours, regenerate
  6. echo "";
  7. }
  8. ? >
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:innodb 2 myisam phpNext article:innodb 2 myisam php