smarty - display和fetch的区别
<?php
include_once "init_smarty.php";
$smarty->assign("title","标题");
$smarty->assign("content","内容");
$output = $smarty->fetch("index.html");
echo $output;
// $smarty->display("index.html");
?>
使用fetch函数,你可以将要输出的html赋值给一个变量,可以对里面的数据进行一些输出,再将他输出。
smarty中的display方法,实际上调用的就是fetch,只不过是直接将他显示出来而已,而fetch默认是不显示,返回给一个变量的。
include_once "init_smarty.php";
$smarty->assign("title","标题");
$smarty->assign("content","内容");
$output = $smarty->fetch("index.html");
echo $output;
// $smarty->display("index.html");
?>
使用fetch函数,你可以将要输出的html赋值给一个变量,可以对里面的数据进行一些输出,再将他输出。
smarty中的display方法,实际上调用的就是fetch,只不过是直接将他显示出来而已,而fetch默认是不显示,返回给一个变量的。
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇: Laravel导出大量数据到表格csv及长数字显示不全问题
- 下一篇:没有了
