使用usort对数组进行排序function cmp($a, $b) { if ($a['weight'] == $b['weight']) { return 0; } return ($a['weight'] < $b['weight']) ? 1 : -1; } usort($result,'cmp');登录后复制