assign_by_ref引用赋值
优质
小牛编辑
125浏览
2023-12-01
void assign_by_ref
(string varname, mixed var)
This is used to assign values to the templates by reference instead of making a copy. See the PHP manual on variable referencing for an explanation.
采用引用的方式赋值到模板中,而不是在模板中创建一个数值的副本。引用的概念可以查看PHP手册的变量引用部分。
Technical Note: This is used to assign values to the templates by reference. If you assign a variable by reference then change its value, the assigned value sees the change as well. For objects, assign_by_ref() also avoids an in-memory copy of the assigned object. See the PHP manual on variable referencing for an in-depth explanation.
注意:本函数用于采用引用的方式赋值到模板中。如果把一个 变量采用引用的方式赋值后,变量的值又被改变了,那么在模板中将会看到变量改变后的值。对于对象,assign_by_ref()函数也避免了对象的内存 拷贝。进一步的解释可以查看PHP手册的变量引用部分。
Example 13-4. assign_by_ref
|