$rs = $model->getParSorts();
創(chuàng)新互聯(lián)專注于衡山企業(yè)網(wǎng)站建設,成都響應式網(wǎng)站建設公司,商城網(wǎng)站定制開發(fā)。衡山網(wǎng)站建設公司,為衡山等地區(qū)提供建站服務。全流程按需制作網(wǎng)站,專業(yè)設計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務
$parr = array();
foreach($rs as $key=>$val){
if($val['pid'] == 0){
$parr[$val['id']]['pname'] = $val['name'];
unset($rs[$key]);
}
}
;
foreach($parr as $key=>$val){
foreach($rs as $oc=>$item){
if($key == $item['pid']){
$parr[$key]['carr'][$item['id']] = $item;
unset($rs[$oc]);
}
}
}
foreach($parr as $key=>$val){
foreach($val['carr'] as $a=>$b){
foreach($rs as $oc=>$item){
if($a == $item['pid']){
$parr[$key]['carr'][$oc]['carr'][$item['id']] = $item;
}
}
}
}