thinkphp 分页URL 规则

浏览:1391 发布日期:2016/05/12 分类:求助交流
MerchantsController.classclass MerchantsController extends ContentController{

    public function index(){
        $m = M('merchants');      
        $count = $m->count();
        $p = getpage($count,2);
        $list = $m->field(true)->where($where)->order('id')->limit($p->firstRow, $p->listRows)->select();
        $this->assign('select', $list); // 赋值数据集
        $this->assign('page', $p->show()); // 赋值分页输出
        $this->display();
    }
 }
function的代码//分页
function getpage($count, $pagesize = 10) {
    $p = new Think\Page($count, $pagesize);
    $p->setConfig('header', '<li class="rows">共<b>%TOTAL_ROW%</b>条记录 第<b>%NOW_PAGE%</b>页/共<b>%TOTAL_PAGE%</b>页</li>');
    $p->setConfig('prev', '上一页');
    $p->setConfig('next', '下一页');
    $p->setConfig('last', '末页');
    $p->setConfig('first', '首页');
    $p->setConfig('theme', '%FIRST%%UP_PAGE%%LINK_PAGE%%DOWN_PAGE%%END%%HEADER%');
    $p->lastSuffix = false;//最后一页不显示为总页数
    return $p;
}
错误的URL
http://localhost:801/index.php/Merchants/index/m/admin/p/2.html
正确的URL
/index.php?m=admin&c=Merchants&p=3
最佳答案
评论() 相关
后面还有条评论,点击查看>>