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}
阅读剩余
版权声明:
作者:松跃笔记
链接:https://www.attm.cn/2024/11/06/thinkphp%e6%a1%86%e6%9e%b6paginate%e5%b8%a6%e5%8f%98%e9%87%8f%e5%8f%82%e6%95%b0%e7%9a%84%e5%88%86%e9%a1%b5/
文章版权归作者所有,未经允许请勿转载。
THE END