第一种:若是你愿意花费时间写一套模板解析方法的话,那么能够直接读取模板,而后将模板里的标签解析掉,再写入。 php
具体代码略…… html
第二种:使用ob缓冲区 框架
例子: 测试
ob_end_clean(); ob_start(); $this->display('article');//框架中显示页面的方法 $html=ob_get_contents(); ob_end_clean();解释:
ob_start()与ob_end_clean()之间的内容不会显示在页面中,而是会存放在缓冲区中,而ob_get_contents()能够获取缓冲区中的内容。 this
以后再将$html写入到文件中,步骤略。 code
第三种:用file_get_contents()模拟游客抓取页面 htm
例如:要生成 article.php?aid=123 这个页面 get
能够用 模板
$html=file_get_contents("http://www.abc.com/article.php?id=123"); class
file_put_contents('/html/123.html',$html);
没测试过,能够试试看