//排序 $sort = array( 'direction' => 'SORT_DESC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序 'field' => 'ztz', //排序字段 ); $arrSort = array(); foreach($arr AS $uniqid => $row){ //需要排序的数组$arr foreach($row AS $key=>$value){ $arrSort[$key][$uniqid] = $value; } } if($sort['direction']){ array_multisort($arrSort[$sort['field']], constant($sort['direction']), $arr); }
已经获取的二维数组排序