zoukankan      html  css  js  c++  java
  • YII2连表分页

    控制器(controller)页面

    use yiidataPagination;  //引入这个类

    public function actionList(){

            $data = Clock::find()->select('*')->innerJoin('user','clock.user_id=user.id'); //联查  

            $pages = new Pagination(['totalCount'=>$data->count(),'pageSize'=>3]);

            $res = $data->offset($pages->offset)->limit($pages->limit)->asArray()->all();

            return $this->render('list',['data'=>$res,'pages'=>$pages]);

    }

    视图(views)层

    <?= yiiwidgetsLinkPager::widget([

            'pagination' => $pages, 

            'nextPageLabel' => '下一页', 

            'prevPageLabel' => '上一页', 

            'firstPageLabel' => '首页', 

            'lastPageLabel' => '尾页'

    ]);?>

    <div style="float:left;padding-left:400px;"><?= yiiwidgetsLinkPager::widget([
    'pagination' => $pages,
    'nextPageLabel' => '下一页',
    'prevPageLabel' => '上一页',
    'firstPageLabel' => '首页',
    'lastPageLabel' => '尾页'
    ]);?></div>
  • 相关阅读:
    如何判断第一个节区头的RVA
    从可执行文件中删除.reloc节区
    动态规划(dynamic programming)
    Ubuntu18安装SQL server
    Ubuntu16.04突然断网
    [Toddler's Bottle]做题记录
    BUU | pwnable_orw
    BUU| 基础破解
    web.xml
    PKIX
  • 原文地址:https://www.cnblogs.com/hangxing1996/p/6796054.html
Copyright © 2011-2022 走看看