看了版主的无限分类,分成树形结构后,如何还原
<br>父子无限分类<br><br>原始数组<br><br>/*<br>获取无线分类,对无线分类进行节点路径排列<br>*/<br>$a=array (<br> 0 =><br> array (<br> 'id' => '134',<br> 'fid' => '0',<br> 'name' => 't',<br> ),<br> 1 =><br> array (<br> 'id' => '133',<br> 'fid' => '0',<br> 'name' => 'k',<br> ),<br> 2 =><br> array (<br> 'id' => '132',<br> 'fid' => '0',<br> 'name' => 'j',<br> ),<br> 3 =><br> array (<br> 'id' => '137',<br> 'fid' => '133',<br> 'name' => '我是k的分类1',<br> ),<br> 4 =><br> array (<br> 'id' => '136',<br> 'fid' => '134',<br> 'name' => '我是t的分类t2',<br> ),<br> 5 =><br> array (<br> 'id' => '135',<br> 'fid' => '134',<br> 'name' => '我是t的分类t1',<br> ),<br> 6 =><br> array (<br> 'id' => '138',<br> 'fid' => '137',<br> 'name' => '我是k的分类1-1',<br> ),<br> 7 =><br> array (<br> 'id' => '139',<br> 'fid' => '138',<br> 'name' => '我是k的分类1-1-1',<br> ),<br> 8 =><br> array (<br> 'id' => '140',<br> 'fid' => '139',<br> 'name' => '我是k的分类1-1-1-1',<br> ),<br>)<br>?><br><br>开始形成树,并且增加路径,树形数组为$trees<br>Array<br>(<br> [0] => Array<br> (<br> [id] => 134<br> [fid] => 0<br> [name] => t<br> [path] => 134<br> [_sub] => Array<br> (<br> [0] => Array<br> (<br> [id] => 136<br> [fid] => 134<br> [name] => 我是t的分类t2<br> [path] => 134,136<br> )<br><br> [1] => Array<br> (<br> [id] => 135<br> [fid] => 134<br> [name] => 我是t的分类t1<br> [path] => 134,135<br> )<br><br> )<br><br> )<br><br> [1] => Array<br> (<div class="clear"> </div>