//二维数组排序 function arrSort($data , $sort){ // $sort = array( // 'direction' => 'SORT_DESC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序 // 'field' => 'age', //排序字段 // ); $arrSort = array(); foreach($data AS $uniqid => $row){ foreach($row AS $key=>$value){ $arrSort[$key][$uniqid] = $value; } } if($sort['direction']){ array_multisort($arrSort[$sort['field']], constant($sort['direction']), $data); } return $data; }