二维数组排序
/** * [ArraySort 二维数组排序] * @param [type] $data [二维数组] * @param [type] $key [根据key排序] */ public function ArraySort($data, $key){ $sort = array( 'direction' => 'SORT_DESC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序 'field' => $key, //排序字段 ); $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; }