国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗(yàn) > 正文

php中sm,arty區(qū)域循環(huán)的方法

2019-11-02 14:23:28
字體:
供稿:網(wǎng)友

 本文實(shí)例講述了php中smarty區(qū)域循環(huán)的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <html> <head> <title>Smarty Test</title> </head> <body> <table border=1> {foreach key=key1 item=item1 from=$array1} <tr> <td>{$key1}</td> <td>{$item1}</td> </tr> {/foreach} </table> </body> </html> 1 2 3 4 5 6 7 <?php require 'libs/Smarty.class.php'; //包含Smarty類庫文件 $smarty = new Smarty; //創(chuàng)建一個(gè)新的Smarty對象 $array1 = array(1 => "Simon", 2 => "Elaine", 3 => "Susan"); //定義數(shù)組
一個(gè)字網(wǎng)名[www.la240.com/html2017/1/36/]
$smarty->assign("array1",$array1); //對模版中的變量賦值 $smarty->display('test3.htm'); //顯示頁面 ?>

另一種方法:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <html> <head> <title>Smarty Test</title> </head> <body> <table border=1> {section name=section1 loop=$array1} <tr> <td</td> <td>{$array1[section1]}</td> </tr> {/section} </table> </body> </html>   1 2 3 4 5 6 7 <?php require 'libs/Smarty.class.php'; //包含Smarty類庫文件 $smarty = new Smarty; //創(chuàng)建一個(gè)新的Smarty對象 $array1 = array(0 => "Simon", 1 => "Elaine", 2 => "Susan"); //定義數(shù)組 $smarty->assign("array1",$array1); //對模版中的變量賦值 $smarty->display('test10.htm'); //顯示頁面 ?>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 白玉县| 岚皋县| 扎兰屯市| 十堰市| 康马县| 鹤庆县| 桂平市| 嘉善县| 渭南市| 永仁县| 静宁县| 木兰县| 禄丰县| 曲沃县| 崇阳县| 无棣县| 抚州市| 丰镇市| 宜兰县| 阳信县| 安宁市| 清河县| 大方县| 泽库县| 西宁市| 松桃| 阿拉善盟| 沈阳市| 鄂温| 襄垣县| 南京市| 永春县| 达州市| 江口县| 义乌市| 吴川市| 北辰区| 寻甸| 岳阳县| 汝城县| 文成县|