php smarty 模板section入门教程与实例

作者:袖梨 2022-06-25
 代码如下 复制代码

include("smarty_inc.php");
include("config.php");

$rzlysql = "SELECT * FROM `log_reply`";
$rzlyr = mysql教程_query($rzlysql,$conn);
while($nam=mysql_fetch_array($rzlyr)){
$name[] = array("id" => $nam["id"], "info" => $nam["info"], "ip" => $nam["ip"], "time" => $nam["time"], "Reply" => $nam["Reply"] );
}
$smarty->assign("title",$name);
$smarty->display("index.html");

?>

然后是 index,html

 代码如下 复制代码

<{section name=y loop=$name}>
<{$title[y].id}> - <{$title[y].info}> - <{$title[y].ip}> - <{$title[y].time}> - <{$title[y].Reply}>
<{sectionelse}>
www.111com.net
<{/section}>

相关文章

精彩推荐