TP框架中分页类的使用

 1 public function test(){
 2             $m=M('Message');
 3 
 4             import('ORG.Util.Page');// 导入分页类
 5             $count    = $m->count();// 查询满足要求的总记录数
 6             $page    = new page($count,3);// 实例化分页类 传入总记录数和每页显示的记录数
 7             $page->setConfig('header','条信息');
 8             $show = $page->show();// 分页显示输出
 9             $this->assign('page',$show);// 赋值分页输出
10             $list  = $m->limit($page->firstRow.','.$page->listRows)->select();
11             $this->assign('list',$list);// 赋值数据集
12             $this->display();
13         }

 

posted @ 2015-09-19 11:47  哟风  Views(7373)  Comments(0Edit  收藏  举报