ThinkPHP
1 简洁分页
$list = Db::name('user')->where('status',1)->order('id', 'desc')->paginate(10, true);
2 带参数分页
$list = Db::name('user')->where('status',1)->paginate([ 'list_rows'=> 20, 'query' => request()->param(), ]);
注意,在使用过程中,tp6 分页传参用的不是
->paginate(2, false, ['query' => request()->param()]);
而是
->paginate(['list_rows'=>2,'query' => request()->param()]);