掃碼下載編程獅APP
W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
appendByRef() — 引用追加
void appendByRef(string varname, mixed var, bool merge);
和 append() 一樣,把值追加到數(shù)組,但以引用的方式來傳遞值。
append()
在PHP5中,appendByRef()在大部分時候都是沒有必要的。只當你希望在模板中可以修改某個PHP數(shù)組的值,才有可能會使用到appendByRef(),當然更好的方法是通過傳遞對象、改變對象的成員變量來達到目的。
appendByRef()
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.
merge
array_merge()
Example 14.5. appendByRef()
<?php // 追加鍵值對 $smarty->appendByRef('Name', $myname); $smarty->appendByRef('Address', $address); ?>
參見 append(), assign() 和 getTemplateVars().
assign()
getTemplateVars()
更多建議:
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: