0 =>
array (size=12)
'id' => string '1' (length=1)
'name' => string 'Test' (length=13)
'parent_id' => string '0' (length=1)
'path' => string '0,' (length=2)
'order' => string '100' (length=3)
'from' => string '0' (length=1)
'qyid' => null
'lng' => string '103.86182' (length=9)
'lat' => string '36.053103' (length=9)
'level' => null
'desc' => null
'level_code' => null
1 =>
array (size=12)
'id' => string '46' (length=2)
'name' => string 'Test2' (length=9)
'parent_id' => string '1' (length=1)
'path' => string '0,1' (length=3)
'order' => string '0' (length=1)
'from' => string '0' (length=1)
'qyid' => null
'lng' => null
'lat' => null
'level' => null
'desc' => null
'level_code' => null
我有如上的一个数组,其中parent_id代表该节点的父节点。我现在打算生成一棵树。我接到前端的html如下:
Test
-
Test2
-
Test3
-
Test4
-
大家也可以忽略上面的html。
那么递归该怎么写呢??? 虚心求教~~