1. 程式人生 > >ThinkPHP5 : 分頁paginate()

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);