fastadmin对查询结果集进行分页
//$arr = array(); //if(!empty($arr)){ //foreach ($arr as $key => $value) { //foreach ($value['productList'] as $k => $v) { //$list[] = $v; //} //} //} $list = array(); $page = ($_GET['offset']/10) + 1; $pagesize = $_GET['limit']; if($page == 1){ $data = []; foreach ($list as $key => $value) { if($key < $pagesize){ $data[] = $value; } } } if($page > 1){ $data = []; foreach ($list as $key => $value) { if(($key >= (($page-1) * $pagesize)) && ($key <= (($page * $pagesize) - 1))){ $data[] = $value; } } } return json(['total'=>count($list),'rows'=>$data]);