Generate static pages regularly (PHP and ASP versions)
Release: 2016-07-25 09:02:18
Original
1197 people have browsed it
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
- 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.
-
- PHP version of scheduled page generation:
-
$file = dirname(__FILE__).'/index.html';
- $timex=time()-filemtime($file); //Interval time , unit second
- if($timex>7200){ //If the interval is greater than 2 hours, regenerate
- echo "";
- }
- ? >
Copy code
|
Statement of this Website
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
Latest Articles by Author
-
2024-09-20 15:51:33
-
2024-09-20 15:47:32
-
2024-09-20 15:45:32
-
2024-09-20 15:39:32
-
2024-09-20 15:38:32
-
2024-09-20 15:27:32
-
2024-09-20 15:26:32
-
2024-09-20 15:12:32
-
2024-09-20 14:53:01
-
2024-09-20 14:51:01