PHP 随机获取数组中的N个数据
作者:互联网
//生成下标数组 $numbers = range (0,$ccc); //shuffle 将数组顺序随即打乱 shuffle ($numbers); //array_slice 取该数组中的某一段 $result = array_slice($numbers,0,$params['select_num']); foreach ($result as $r){ $ary[] = $ids[$r]; }
标签:slice,shuffle,numbers,result,数组,array,PHP,随机 来源: https://www.cnblogs.com/catyxiao/p/15993160.html