php控制数组按指定的KEY排序
function array_sort($arr,$keys,$orderby='asc'){ $keysvalue = $new_array = array(); foreach ($arr as $k=>$v){ $keysvalue[$k] = $v[$keys]; } if($orderby== 'asc'){ asort($keysvalue); }else{ arsort($keysvalue); } reset($keysvalue); foreach ($keysvalue as $k=>$v){ $new_array[] = $arr[$k]; } return $new_array; }