一、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' => '',
      ]);?>

上一篇:Yii2学习笔记十二:Yii2 ActiveForm用法总结

下一篇:Yii2学习笔记十四:Yii2 GridView用法总结