主页 > 编程资料 > PHP >
发布时间:2015-09-16 作者:apizl 阅读:190次

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); 
?>



文章由爱资料原创本文地址:https://www.apizl.com/archives/view-1161-1.html,转载请以链接形式标明本文地址!
关键字词: