PHP的模板可以说是很多了,有功能强大的smarty,还有简单易用的smarttemplate等。它们每一种模板,都有一个获取输出内容的函数。
<?php require("smarty/Smarty.class.php"); $t = new Smarty; $t->assign("title","Smarty!"); $content = $t->fetch("templates/index.htm"); //这里的 fetch() 就是获取输出内容的函数,现在$content变量里面,就是要显示的内容了 $fp = fopen("archives/2015.html", "w"); fwrite($fp, $content); fclose($fp); ?>
关键字词: