PHP完全自学手册(珍藏版) 中文pdf扫描版下载
例子
$dataProvider = new ActiveDataProvider([
'query' => User::find(),
'pagination' => array('pageSize' => 50),
]);
echo \yii\widgets\LinkPager::widget([
'pagination'=>$dataProvider->pagination,
]);
或者使用
$query = User::find();
$pagination = new Pagination(['totalCount' => $query->count(), 'pageSize'=>30]);
echo \yii\widgets\LinkPager::widget([
'pagination' => $pagination,
]);
转载请注明:谷谷点程序 » yii2 dataProvider 分页的方法