ThinkPHP3.2.3 文章加分页

2025-04-18 02:07:12

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\Contr泠贾高框oller;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 文章加分页
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢