This question already has answers here:
LIMIT is not working in ActiveDataProvider
(2 个回答)
5年前关闭。
例如,我正在尝试进行查询以获取第一个 10 条记录 ,并将其传递给
查询工作正常并仅返回所需数量的记录,而
Reference
(2 个回答)
5年前关闭。
例如,我正在尝试进行查询以获取第一个 10 条记录 ,并将其传递给
ActiveDataProvider
。查询工作正常并仅返回所需数量的记录,而
ActiveDataProvider
正在打印所有记录,这是我的代码: $query = new \yii\db\Query;
$query->select('*')
->from('customers')
->limit(10);
$query->createCommand();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
最佳答案
将 Pagination
设置为 false
:
$dataProvider = new ActiveDataProvider([
'pagination' => false
]);
Reference
关于mysql - 如何限制对 ActiveDataProvider 的查询?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34284800/
10-10 00:24