public function index() {
//把图标改一下样式就可以了
$user = M('User');
import('ORG.Util.Page');
$count = $user->count();
$listRows = 5;
$page = new Page($count, $listRows);
$list = $user->limit("{$page->firstRow},{$page->listRows}")->select();
$page->setConfig('prev', '');//上一页
$page->setConfig('next', '');//下一页
// $page->setConfig('first', '');
// $page->setConfig('last', '');
$page->setConfig('theme', '%upPage% %downPage%');//只显示上下页选项
$this->assign('page', $page->show());
$this->assign('list', $list);
$this->display();
}
php代码:
$goods = new \Model\GoodsModel();
//分页处理
$tatal = $goods->count();//获得总记录数
$per = 5;//每页显示5条数据
$page = new Page($tatal,$per);//实例化分页类对象
$page -> setConfig('header','共%TOTAL_ROW%条记录 第%NOW_PAGE%页/共%TOTAL_PAGE%页');
$page -> setConfig('prev', '上一页');
$page -> setConfig('next','下一页');
$page -> setConfig('last','末页');
$page -> setConfig('first','首页');
$page -> setConfig('theme','%HEADER% %FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END%');
$show = $page->show();// 分页显示输出
$list = $goods->order('goods_id desc')->limit($page->firstRow.','.$page->listRows)->select();
//dump($page);exit;
$this -> assign('list',$list);// 把获取的信息传递给模板使用
$this -> assign('page',$show);// 赋值分页输出
$this -> display(); // 输出模板
你自己根据你的需要替换一下就可以,