无极分类方法
- $list = C::t('#piaobo_center#piaobo_center_nav')->fetch_all();foreach (array_keys($list) as $key) { if ($list[$key]['parentid'] == 0) { continue; } if (putlevel($list, $list[$key])) { unset($list[$key]); }}function putlevel(&$list, $tree) { if (empty($list)) { return false; } foreach ($list as $key => $val) { if ($tree['parentid'] == $val['id'] && $tree['id'] != $tree['parentid']) { $list[$key]['level'][] = $lists[$list[$key]['path']]['level'][] = $tree; return true; } if (isset($val['level']) && is_array($val['level']) && !empty($val['level'])) { if (putlevel($list[$key]['level'], $tree)) { return true; } } } return false;}unset($key,$val);