thinkphp框架paginate带变量参数的分页

后台php

public function index()
    {
    	if (input('yuansuo') != null) {
    		$grade= input('grade');
    		$result = db('db')->where('grade',$grade)->order('id desc')->paginate(20,false,['query'=>array('grade'=>$grade)]);
    	}else{
    		$grade= 0;
    		$result = db('baoming')->order('id desc')->paginate(50);
    	}
    	$this->assign('result',$result);
    	// 把分页数据赋值给模板变量list
		$page = $result->render();

		$this->assign('page', $page);
		$this->assign('grade',$grade);
        return $this->fetch('/index');
    }

前台分页标签

{$page}

 

阅读剩余
THE END