function arr_sort ($array, $key, $order = "asc") {//asc是升序 desc是降序 $arr_nums = $arr = array(); foreach ($array as $k => $v) { $arr_nums[$k] = $v[$key]; } if ($order == 'asc') { asort($arr_nums); } else { arsort($arr_nums); } foreach ($arr_nums as $k => $v) { $arr[$k] = $array[$k]; } return $arr; }