//随机获取200作为当天需要显示的总数据 $lastData=call_user_func(function($data,$num){ $temp=array_rand($data,$num); //重组数组 foreach($temp as $val){ $data_last[]=$data[$val]; } return $data_last; },$data,200);