我以前用 Smarty模板的时候生成过。http://www.juneshi.cn/?p=27PHP直接生成方法应该也类似吧。------------------------------------------
酷得组件仓库 - 第三方软件开发组件下载\试用
www.cookcode.net

解决方案 »

  1.   

    你是想让index.html 支持<?php ?>呢?
    还是定时把index.php生成静态页?
      

  2.   

    直接把index.php生成index.html然后每隔一个小时将index.html自动更新一次
      

  3.   

    可以直接 加我QQ87127173 或MSN  [email protected]
      

  4.   

    php里把页面源码输出到html文件,为了定时更新html可以通过html中js ajax来做
      

  5.   

    更改一下apache配置的MIME类型,应该是可以的。
      

  6.   

    直接用php 来刷静态.<?
    /**
    * 进行文件刷静态处理.

    * 这里是详细说明.
    * @author  徐兴
    * @package  lib
    * @version v1.0
    * @copyright juwangTech.
    *
    */class obClass {

    /**
     * *
     * @var 目标静态文件 $destFile
     * @var 目标旗帜    $lifeFlag
     * @var 文件句柄s   $fp
     */
    private $destFile;
    private $lifeFlag;
    private $fp;
       function obClass() {  }

        //加载文件
    function loadFile( $destFile )
    {
    $this->destFile  = $destFile;
    //$this->lifeFlag = time() - fileatime($this->destFile);
    }

        /**
     * 检查文件的存在时间.
     *
     * @param 所指定文件的存在时间 $time
     * @return bool
     */
    function check( $time )
    {
       if(file_exists( $this->destFile ))
       {
    $this->lifeFlag = $time + fileatime( $this->destFile ) - time();
       }
       else {
        $this->lifeFlag = -1;
       }
    if($this->lifeFlag > 0)
    {
    if(DEBUG == '1')
    echo "此文件在指定生存期内,不进行刷静态";
    return false;
    }
    else {
    if(DEBUG == '1')
    echo "开始刷静态文件".$this->destFile."<hr/>";
    ob_start();
    return true;
    }

    }

    /**
     * 将缓冲写入到文件中去..
     *
     */ 
    function write()
    {
    if( $this->lifeFlag > 0 ) exit();

    $this->fp = fopen( $this->destFile , "w" );
    fwrite( $this->fp , ob_get_contents() );

    ob_clean();
    if( DEBUG == '1' )
    echo "开始刷静态文件".$this->destFile."<hr/>";
    fclose( $this->fp );
    }
    }?>用法.<?
    if(!defined("DEBUG")) define("DEBUG","1");
        require("obClass.php");
     /** ob 类的使用流程*
      *  1一新建一个ob对象。
      *  2二加载需要ob的文件
      *  3判断文件生存时间,写入要刷表态的内容,刷静态处理.
      */   
     
     
     //一新建一个ob对象
    $ob = new obClass();

    //二加载需刷静态的文件
     $dest_file = "index.html";
    $ob->loadFile($dest_file); if($ob->check(0))
    {  
    /*****
    * 把你的index.php放到这里就OK了.
    * 把你的index.php放到这里就OK了.
    *  把你的index.php放到这里就OK了.
    *  把你的index.php放到这里就OK了.
    */
    $ob->write();
    }
    } ?>
      

  7.   

    真有意思啊。楼上的写法不错。看上去可以直接用了。但如果是我,我会用第三方手段定时更新缓存(静态页)。生成静态页,本来就是为了节省apache的资源的。@_@
      

  8.   

    然后定期执行在crontab设置一下每小时执行一次
      

  9.   

    Error 403--Forbidden 有没有人知道这个是不是index.html文件丢失的问题