在这里记录一下Tp5保持分页状态的两种方法:
一:
Db::name('data') -> where($where) -> paginate(5,false,['query' => request()->param()]);
二:
$params = $this -> request -> param();
$users = Db::name('data')->where($where)->paginate(15);
// 在 render 前,使用appends方法保持分页条件
$users->appends($params);
$this->assign('page', $users->render());//单独提取分页出来
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!