lw1995

控制器

 public function lst(){
        $product=D(\'products\');
        $count = $product->count();  // 查询满足要求的总记录数
        $page = new \Think\Page($count,2); // 实例化分页类 传入总记录数和每页显示的记录数(25)
        $show = $page->show();  // 分页显示输出
        $this->assign(\'page\',$show);  // 赋值数据集
        // 进行分页数据查询 注意limit方法的参数要使用Page类的属性
        $doc_list =$product->limit($page->firstRow.\',\'.$page->listRows)->select(); // 赋值分页输出
        $this->assign(\'pro\',  $doc_list);
        $this->display();
    }

 

 

前台模板:

{$page}

 

分类:

技术点:

相关文章:

  • 2021-11-29
  • 2021-12-09
  • 2021-04-15
  • 2021-11-27
  • 2021-10-07
  • 2021-09-09
  • 2021-08-21
猜你喜欢
  • 2021-11-23
  • 2017-11-29
  • 2021-09-11
  • 2021-09-11
  • 2021-10-02
  • 2021-10-20
  • 2021-11-29
相关资源
相似解决方案