Name
appendByRef() 鈥 寮曠敤杩藉姞
璇存槑
void聽appendByRef(string聽varname,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽mixed聽var,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽bool聽merge);
鍜
append()
涓鏍凤紝鎶婂艰拷鍔犲埌鏁扮粍锛屼絾浠ュ紩鐢ㄧ殑鏂瑰紡鏉ヤ紶閫掑笺
鎶鏈鏄
鍦≒HP5涓紝appendByRef()
鍦ㄥぇ閮ㄥ垎鏃跺欓兘鏄病鏈夊繀瑕佺殑銆傚彧褰撲綘甯屾湜鍦ㄦā鏉夸腑鍙互淇敼鏌愪釜PHP鏁扮粍鐨勫硷紝鎵嶆湁鍙兘浼氫娇鐢ㄥ埌appendByRef()
锛屽綋鐒舵洿濂界殑鏂规硶鏄氳繃浼犻掑璞°佹敼鍙樺璞$殑鎴愬憳鍙橀噺鏉ヨ揪鍒扮洰鐨勩
Technical Note
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()
.