ShopsN查询多条数据分页使用paginate方法(分页变量page),例如:
/** * 获取商品列表 * @author 王波 * $date 2020-09-03 **/ public function getGoodsListByPage() { $where = []; $where[] = ['shelves','=',1]; $where[] = ['approval_status','=',1]; $field = 'id,title,pic_url'; $goods = GoodsModel::field($field) ->where($where) ->order('id','desc') ->paginate(10)->toArray(); if(empty($goods)){ $this->errorMessage = "商品信息错误"; return false; } return $goods; }