W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
appendByRef() — 引用追加
void appendByRef(string varname,
mixed var,
bool merge);
和 append()
一樣,把值追加到數(shù)組,但以引用的方式來傳遞值。
在PHP5中,appendByRef()
在大部分時(shí)候都是沒有必要的。只當(dāng)你希望在模板中可以修改某個(gè)PHP數(shù)組的值,才有可能會使用到appendByRef()
,當(dāng)然更好的方法是通過傳遞對象、改變對象的成員變量來達(dá)到目的。
The merge
parameter respects array keys, so if you merge two numerically indexed arrays, they may overwrite each other or result in non-sequential keys. This is unlike the PHP array_merge()
function which wipes out numerical keys and renumbers them.
Example 14.5. appendByRef()
<?php // 追加鍵值對 $smarty->appendByRef('Name', $myname); $smarty->appendByRef('Address', $address); ?>
參見 append()
, assign()
和 getTemplateVars()
.
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: