//分页开始 $count=M('article')->where($condition)->count(); $p = intval($p) > 0 ? $p : 1; $pagesize = 9;#每页数量 $offset = $pagesize * ($p - 1);//计算记录偏移量 $page = new \Think\Page($count, $pagesize); $page = $page->show(); $this->assign('page', $page); $data=M('article')->where($condition)->order("aid desc")->limit($offset . ',' . $pagesize)->select(); $this->assign('data',$data); $this->display();