When adding elements to a child element in an array using the Arry_push method, it should be noted that the following occurs when using a predefined element push:
Array_push ($bladeList[0][' Children '],$nodeList), the results are different!
$bladeList=Array(); $nodeList=Array(); Array_push($nodeList,Array( "Text" = ' Test ', "status" = ' 1 ', "checked" and "="false, "leaf" =true )); Array_push($bladeList,Array( "Text" = ' testrt ', ' status ' = ' 1 ', ' expanded ' =true, "Checked" =false, "Children" =$nodeList )); Array_push($bladeList[0] [' Children '],$nodeList);
The output results are as follows:
checked false Children checkedfalse expandedtrue text: "3"
//"Children" =$nodeList Get the following structure
0: checked:false leaf:true status:0 text: "108"
//Array_push($bladeList[0][' Children '],$nodeList); Get the following structure
1: 0: checked:false leaf:true status:0 Text: "108"
expanded: true
text: "10.0"
Array_push ($bladeList[0][' Children '],$nodeList);
PHP Arry_push Method Usage Note