怎么把PHP页面生成html页?用伪静态怎么做啊??

解决方案 »

  1.   

    http://www.pcjx.com/Linux/PHP/62918.html需配置APACHE中的http.conf文件
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteRule ^/(.+).html$ /$1.php
    </IfModule>以上是一个最简单的将PHP文件以html页面呈现的例子
      

  2.   

    php生成html
      

  3.   

    对。 是把我的PHP页面生成为静态。 怎么做啊。
      

  4.   

    生成静态html页面,直接用php的文件操作功能即可。
    伪静态需要配置。
      

  5.   

    $title = $_POST['title'];
    $content = $_POST['content'];
    $dir = "art/";
    $countfile = $dir."count.txt";
    echo $countfile;if(!file_exists($countfile)){
    fopen($countfile,"w");
    }
    $fp = fopen($countfile,"r");
    $num = fgets($fp,20);
    $dat = date("Yis");
    fclose($fp);
    $houzui = ".htm";
    $path = $dat.$houzui;
    $fp = fopen("model.htm","r");
    $str = fread($fp,filesize("model.htm"));
    $str = str_replace("{title}",$title,$str);
    $str = str_replace("{content}",$content,$str);
    fclose($fp);
    $handle =fopen($path,"w");
    fwrite($handle,$str);
    fclose($handle);
      

  6.   

    有几种方法:1. URL重写;2. 使用文件操作函数读取模板文件,进行占位符替换即可;3. 可以考虑使用smarty这样的模板引擎,也可以实现你要的功能.
      

  7.   

    开通伪静态<IfModule dir_module>
        DirectoryIndex index.php index.html index.htm
    </IfModule>
      

  8.   

    想真正是了解生成静态页面的原理那就找个国内的CMS去分析一下吧~~~~国内的CMS喜欢讲页面生成静态 比如DEDE
      

  9.   

    基本的原理是读取模版页面,替换模版中指定的变量,然后通过文件操作生成html页面
    tp框架有封装的生成方法
    但是目前cms使用的生成流程比较复杂