zoukankan      html  css  js  c++  java
  • thinkphp5 分页 paginate

    tp5分页带参数的时候,用到 paginate 后面的几个参数

    paginate有三个参数,

    第一个必须表是每页分多少个[如果配置文件中设置了,可以不用]

    第二个参数表是的是简洁分页,如果为true,那么分页的就是只有上一页和下一页

    第三个参数是一个数组,具体可以自己传入或者在配置文件中配置。

    参数 描述
    list_rows 每页数量
    page 当前页
    path url路径
    query url额外参数
    fragment url锚点
    var_page 分页变量
    type 分页类名

    这里我们需要用到query闭包查询。

    $result=Db::table('activate')->alias('a')
                ->field('a.id,a.cid,a.activation_code,a.state,a.activation_time,c.cname')
                ->join('customer c','c.cid=a.cid')
                ->where($map)
                ->order('a.id asc')
                ->paginate(10,false,['query' => request()->param()]);
            $page=$result->render();
            $str='共'.$result->total().'条记录';
            $page=str_replace('TOTAL',$str,$page);
     return array($result,$page);
      
    

      

  • 相关阅读:
    Pascal's Triangle II
    Pascal's Triangle
    Best Time to Buy and Sell Stock II
    Best Time to Buy and Sell Stock
    Populating Next Right Pointers in Each Node
    path sum II
    Path Sum
    [转载]小波时频图
    [转载]小波时频图
    [转载]Hilbert变换及谱分析
  • 原文地址:https://www.cnblogs.com/ampl/p/8119146.html
Copyright © 2011-2022 走看看