public function index($page=1,$rows=20) { $syscode = M('SystemCode'); // 实例化User对象 $count = $syscode->where('code_state=0')->count();// 查询满足要求的总记录数 $list = $syscode->where('code_state=0')->order('create_time desc')->page($page.','.$rows)->select(); //生成翻页HTML代码 C('VAR_PAGE', 'page'); $pager = new ThinkPageBack($count, $rows, $_REQUEST); $pager->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%'); $paginationHtml = $pager->show(); $this->assign('list',$list);// 赋值数据集 $this->assign('page',$paginationHtml);// 赋值分页输出 $this->display(); }