PHP Automatic Production static page

Source: Internet
Author: User
Tags comments functions min variable

01 if(file_exists("./index.htm"))//看静态index.htm文件是否存在{
02     ", $time =time ();
03
04     //文件修改时间和现在时间相差?的话,直接导向htm文件,否则重新生成htm
05     if($time-filemtime("./index.htm")< 600){
06 &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; header" ( location:classhtml/main.htm" );
07     ", }
08 }
09
10 //在你的开始处加入ob_start();
11 ob_start();
12
13 //首页内容,就是你的动态部分了
14
15 //在结尾加入ob_end_clean(),并把本页输出到一个变量中
16 $temp =ob_get_contents ();
17 ob_end_clean();
18
19 //写入文件
20 $fp=fopen("./index.htm",'w');
21 fwrite($fp,$tempordie('写文件错误'); 
22 //echo"生成HTML完成!";


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.