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

セクション、セクションelse 関數(shù)

#section,sectionelse function:

section タグはペアで指定する必要があります。名前とループ屬性を設(shè)定する必要があります。

名前は、文字、數(shù)字、アンダースコアの任意の組み合わせにすることができます。ネストすることもできますが、ネストされた名前は一意である必要があります。

##変數(shù)ループによって決定されます (通常は配列) ループが実行される回?cái)?shù)

#必要な場合 セクション ループ內(nèi)で変數(shù)を出力する場合、角かっこで囲まれた name 変數(shù)を変數(shù)の後に追加する必要があります。

#sectionelse は、ループ変數(shù)に値がない場合に実行されます。

##eg1:

test.php:

##$smarty->assign('custid',array( 1000, 10001,10002));

test.html:

{セクション名=顧客ループ=$custid}

id: {$custid[customer]}<br>{/section}

出力:
id: 1000<br>
id: 1001<br>
id: 1002<br>




eg2: (多次元配列を走査)

test.php:

##$smarty->assign('連絡(luò)先', array(

array('custid'=> ; 1000,'name'=>'smile1','address'=>'合肥'),

array('custid'=>1000,'name'=>'smile2','address' = >'上海'), array('custid'=>1000,'name'=>'smile3','address'=>'北京'),));


test.html:


##{セクション名=顧客ループ=$contacts}
id: {$contacts[顧客].custid}< ;br>

名前: {$contacts[顧客].名前}<br>

アドレス: {$contacts[顧客].アドレス}<br>{/セクション}

出力:


id: 1000
name: smile1
address: 合肥

id: 1000

name: smile2address : 上海id: 1000name: smile3
address: 北京





##eg3:(セクション他のデモ)

test.php:

##

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

test.html:

{セクション名=顧客ループ=$custid}
id: {$custid[顧客]}<br>
{sectionelse}
$custid.
{ には値がありません。 /section}

出力:

$custid.

には値がありません。
學(xué)び続ける
||
<?php echo "section,sectionelse函數(shù)";