Thinkphp5 对数组进行分页
- 作者 : zfajax舫
- |
- 发布时间 : 6年前
- |
- 评论数 : 0
- 查看数 : 75
use think\paginator\driver\Bootstrap;
.
.
.
$list = []; #要进行分页的数据
$listRows = 4; #每页展示的行数
$page = $request->get('page',1); #获取页数
$list = Bootstrap::make(array_slice($list, ($page - 1) * $listRows, $listRows, true), $listRows, $page, count($list), false,[
'var_page' => 'page',
'path' => url('/index/index/jyds'), #定义翻页链接
'fragment' => '',
]);