当前位置:多学网学习教育电脑学习编程入门PHP教程$smarty->fetch 的使用

$smarty->fetch 的使用

[08-23 22:09:51]   来源:http://www.duoxue8.com  PHP教程   阅读:640
$smarty->fetch 的使用,标签:PHP技巧,php培训,php学习,php安装,http://www.duoxue8.com

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教程