Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Yii2的elasticsearch限制查询_Php_Activerecord_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Yii2_Limit - Fatal编程技术网 elasticsearch,yii2,limit,Php,Activerecord,elasticsearch,Yii2,Limit" /> elasticsearch,yii2,limit,Php,Activerecord,elasticsearch,Yii2,Limit" />

Php 使用Yii2的elasticsearch限制查询

Php 使用Yii2的elasticsearch限制查询,php,activerecord,elasticsearch,yii2,limit,Php,Activerecord,elasticsearch,Yii2,Limit,我在Yii2中使用elasticsearch和活动记录 静态函数getPosts() { return Post::find() ->orderBy('ID desc') ->全部(); } find()方法工作正常,但如果我添加limit()方法,它将停止工作 静态函数getPosts() { return Post::find() ->orderBy('ID desc') ->限额(20) ->全部(); } 如何在查询限制中使用活动记录、Elasticsearch和Yii2 问候。No

我在Yii2中使用elasticsearch和活动记录

静态函数getPosts()
{
return Post::find()
->orderBy('ID desc')
->全部();
}
find()方法工作正常,但如果我添加limit()方法,它将停止工作

静态函数getPosts()
{
return Post::find()
->orderBy('ID desc')
->限额(20)
->全部();
}
如何在查询限制中使用活动记录、Elasticsearch和Yii2

问候。

Noup

活动记录与limit()函数不兼容


为此,必须使用query()函数。

如何添加方法
count()
?请举个例子。@arogachev对不起,我写错了。我的意思是方法限制(),您使用的是哪个版本的Yii2?