// 获取所有一级分类 $all_category_arr = M('xxx')->where(xxx)->select(); // 处理一级分类的数组,每10个分类为一组,处理后为一个二维数组 $all_category_arr_tow = array(); $aca_n = 0; foreach( $all_category_arr as $aca_k => $aca_v ) { if($aca_k%10 == 0) { $aca_n += 1; } $all_category_arr_tow[$aca_n][] = $aca_v; }