tp3和tp5的分页写法

tp5的分页:

public function index()
    {
        $page = input('get.page');
        if (isset($page) && null !== $page) {
            $cpage = $page;
        }
        else {
            $cpage = 1;
        }
        $options=[
            'page'=>$cpage,
            'path'=>url('index')
        ];
        $list=Db::name('web_member')->paginate(10,false,$options);
        $this->assign('list', $list);
        return $this->fetch();
    }

在html的展示页中要加上   {$list->render()}   来展示分页的页数

tp3的分页:

 public function paylist(){
        $p= I("get.p/d",1);
        $model = M("pay");
        $count = $model->count();
        $Page = new Page($count,10);
        $show = $Page->show();
        $data = $model->order('id desc')->page($p.',10')->select();
        $this->assign('data',$data);
        $this->assign('page',$show);
        $this->display();
    }

在html的展示页中要加上   {$page}  来展示分页的页数

原文地址:https://www.cnblogs.com/nnhgd/p/7953705.html