Hello.圣诞快乐!
我有个数据结构如下:
0 =>
array (size=13)
'id' => string '46' (length=2)
'name' => string 'Test' (length=9)
'parent_id' => string '1' (length=1)
'son' =>
array (size=2)
0 =>
array (size=13)
...
1 =>
array (size=12)
...
1 =>
array (size=13)
'id' => string '914' (length=3)
'name' => string '测试2' (length=9)
'parent_id' => string '0' (length=1)
'son' =>
array (size=3)
0 =>
array (size=12)
...
1 =>
array (size=12)
...
2 =>
array (size=12)
...
我怎么绘制一棵树呢?
<li>
<p class="tree_title">
<img src="images/px_02.png" class="icon_btn"/>
<label class="title">一级</label>
<input type="checkbox" class="view">
<input type="checkbox" class="manage">
</p>
<ul class="space">
<li>
<p class="tree_title">
<img src="images/px_02.png" class="icon_btn"/>
<lavel class="title">二级</lavel>
<input type="checkbox" class="view">
<input type="checkbox" class="manage">
</p>
<ul class="space">
<li>
<p class="tree_title">
<img src="images/px_02.png" class="icon_btn"/>
<label class="title">三级</label>
<input type="checkbox" class="view">
<input type="checkbox" class="manage">
</p>
</li>
</ul>
</li>
</ul>
</li>
想了好久没想出来,其中array的son代表它的子节点。。。