數(shù)組的簡單使用
Smarty對陣列的使用:陣列[下標(biāo)]、陣列.下標(biāo)
修改test.php檔案:
<?php require "./libs/Smarty.class.php"; $smarty = new Smarty; $smarty->assign('address', array('0', '1', array('2--0', '2--1'))); $smarty->display('./templates/test.html');
修改test.html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>test</title> </head> <body> <!--html的注釋--> {*smarty模板的注釋*} <!--{assign var='add' value='ipnx.cn'}--> 我們網(wǎng)站的網(wǎng)址是:{$address[2][0]}<br> 我們網(wǎng)站的網(wǎng)址是:{$address.2.0} </body> </html>
展示如下: