The following editor will bring you an example of thinkphp paging integration. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.
Controller:
##
$User = M('webcase'); // 实例化 User 对象 $list = $User->order('id desc')->page($_GET['p'].',6')->select(); $this->assign('list',$list);// 赋值数据集 $count = $User->count();// 查询满足要求的总记录数 $Page = new \Think\Page($count,6);// 实例化分页类 传入总记录数和每页显示的记录数 $show = $Page->show();// 分页显示输出 $this->assign('page',$show);// 赋值分页输出 $this->display(); // 输出模板
View:
##
{$new.keyword} {$page}
The above is the detailed content of Examples of paging integration in the TP framework. For more information, please follow other related articles on the PHP Chinese website!