php代码
public function sort($arr,$sort,$v){ //$arr->数组 $sort->排序顺序标志 $value->排序字段 if($sort == "0"){ //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序 $sort = "SORT_ASC"; }elseif ($sort == "1") { $sort = "SORT_DESC"; } foreach($arr as $uniqid => $row){ foreach($row as $key=>$value){ $arrsort[$key][$uniqid] = $value; } } if($sort){ array_multisort($arrsort[$v], constant($sort), $arr); } return $arr; }