数组太大不好处理,切割出来处理
$ids = [1, 2, 3, 4, 5, 6, 7, 8, 9]; $count = count($ids);
$size = 2; $pages = new Pagination(['totalCount' => $count, 'defaultPageSize' => $size]); for ($i = 1; $i <= $pages->pageCount; $i++) { $idArr = array_slice($ids, ($i - 1) * $size, $size); var_export($idArr); }