ThinkPHP5 : 分页paginate()【转】

参数

paginate(每页数量,是否简洁分页,分页参数)

使用方式

$list = db('user')->paginate(10);

自定义参数传参

$list = db('user')->paginate(10,false,['query'=>array('id' => $id)]);

其它参数

//  总数据
$this->assign('total',$list->total());
//  总页数
$total= ceil($list->total() / 10);
$this->assign('totalPage', $total);
//  当前页
$page = input('page', 1);

文章来自:https://blog.csdn.net/bo13704427276/article/details/80762804

猜你喜欢

转载自www.cnblogs.com/KillBugMe/p/12409752.html