Thinkphp使用分页

use Think\Page;

$pageCount = I('get.size',20); //每页20条
$condition = array();
$count = $model->where($condition)->count();
$Page = new Page($count, $pageCount); 
$show = $Page->show();
$objs = $model->where($condition)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
$this->page = $show;
$this->obj = $bjs;
      

猜你喜欢

转载自zhangfortune.iteye.com/blog/2304105