亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

foreach,foreachelse函數(shù)

foreach,foreachelse函數(shù)

#使用方法:

foreach 用於處理簡(jiǎn)單陣列(數(shù)組中的元素的類型一致),它的格式比section 簡(jiǎn)單許多,缺點(diǎn)是只能處理簡(jiǎn)單數(shù)組.
foreach 必須和/foreach 成對(duì)使用,並且必須指定 from 和 item 屬性.
name 屬性可以任意指定(字母、數(shù)字和下劃線的組合).
foreach 可以嵌套,但必須保證嵌套中的foreach 名稱唯一.
from 屬性(通常是數(shù)組)決定循環(huán)的次數(shù).
foreachelse 語句在from 變數(shù)沒有值的時(shí)候被執(zhí)行.

test.php:

$smarty->assign('custid', array(1000 ,1001,1002));

test.html:

{foreach from=$custid item=curr_id}
id: {$curr_id}<br>
{/foreach}

#輸出:

微信圖片_20180313094534.png


繼續(xù)學(xué)習(xí)
||
<?php echo "foreach,foreachelse函數(shù)";
提交重置程式碼