thinkphp3.2.3 分页代码分享
发布时间:2020-12-14 14:05:52 所属栏目:大数据 来源:网络整理
导读:对于thinkphp分页的实现效果,两种调用方法,一种调用公共函数中的函数方法(参考),一种是在模型中书写分页的方法 1、在公共函数Application/Common/Common/function.php中书写: setConfig('header',' 共 %TOTAL_ROW% 条记录 %NOW_PAGE% / %TOTAL_PAGE% 页
对于thinkphp分页的实现效果,两种调用方法,一种调用公共函数中的函数方法(参考),一种是在模型中书写分页的方法 1、在公共函数Application/Common/Common/function.php中书写: setConfig('header','
在控制器PageController.class.php中调用 count();
$page= getpage($count,8);//Common/function.php中分页
$list=$m->limit($page->firstRow,$page->listRows)->select();
$this->assign('list',$list);//赋值数据集
$this->assign('page',$page->show());//赋值分页输出
$this->display();
}
}
在视图index/index.html中显示 |