手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

ThinkPHP3.2.3 文章加分页

时间:2024-10-17 22:49:46

1、找到“根目录下\项目名\Home\View\”中的“index.html”

ThinkPHP3.2.3 文章加分页

2、代码如下:{$page}

ThinkPHP3.2.3 文章加分页

3、找到“根目录下\项目名\Home\Controller”中的“IndexController.class.php”

ThinkPHP3.2.3 文章加分页

4、代码如下:<?phpnamespace Home\Controller;use Think\Controller;class IndexController extends Controller { public function index(){ $Article = M('Goods'); // 实例化数据对象 $where['e']='茶'; $count = $Article->where($where)->count();// 查询满足要求的总记录数 $Page = new \Think\Page($count, 10);// 实例化分页类 $show = $Page->show();// 分页显示输出 $orderby['e']='desc';// 排序条件 $list = $Article->where($where)->order($orderby)->limit($Page->firstRow.','.$Page->listRows)->select(); $this->assign('list',$list);// 赋值数据集 $this->assign('page',$show);// 赋值分页输出 $this->display(); // 输出模板 }}

ThinkPHP3.2.3 文章加分页

5、大功告成,O(∩_∩)O~~

ThinkPHP3.2.3 文章加分页
© 手抄报圈