二维数组排序
public function index() { $data = [ [ 'id' => 1, 'b' => '11', 'c' => '11', ], [ 'id' => 2, 'a' => '33', 'b' => '33', ], [ 'id' => 3, 'a' => '22', 'b' => '22', ] ]; //根据字段a对数组$data进行降序排列 $a_arr = array_column($data, 'a'); array_multisort($a_arr, SORT_DESC, $data); return $data; }