Yii2学习笔记十三:Yii2 LinkPager用法总结
一、Yii2 LinkPager控制器中使用
//分页插件 $query = Country::find(); $countQuery = clone $query; $pages = new Pagination(['totalCount' => $countQuery->count(),'pageSize' => '5']); $models = $query->offset($pages->offset) ->limit($pages->limit) ->all(); return $this->render('index', [ 'models' => $models, 'pages' => $pages, ]);
二、Yii2 LinkPager视图中使用
<?php echo \yii\widgets\LinkPager::widget([ 'pagination'=>$page, 'options' => ['class'=>''], 'linkOptions'=>['class'=>'skew25'], 'activePageCssClass'=>'active selected', 'nextPageLabel' => '', 'prevPageLabel' => '', ]);?>
文章
总共 0 条评论