学习、分享、快乐
当前位置 >> 68楼学习网学习教育电脑学习编程入门PHP教程$smarty->fetch 的使用

$smarty->fetch 的使用

[08-23]   来源:http://www.68lou.com  PHP教程   阅读:640

$smarty->fetch 的使用,本站还有更多关于PHP教程,PHP技巧,php培训,php学习,php安装的文章。
正文:

include("Smarty.class.php");$smarty = new Smarty;
$smarty->caching = true;
// only do db calls if cache doesn't exist// 只有在缓存不存在时才调用数据库if(!$smarty->is_cached("index.tpl")){
// dummy up some data $address = "245 N 50th"; $db_data = array( "City" => "Lincoln", "State" => "Nebraska", "Zip" = > "68502" );
$smarty->assign("Name","Fred"); $smarty->assign("Address",$address); $smarty->assign($db_data);
}
// capture the output// 捕获输出$output = $smarty->fetch("index.tpl");
// do something with $output here// 对将要输出的内容进行处理
echo $output;




如果觉得$smarty->fetch 的使用不错,可以推荐给好友哦。
Tag:PHP教程PHP技巧,php培训,php学习,php安装电脑学习 - 编程入门 - PHP教程