我正在为我的Symfony项目使用Elastica搜索引擎。
现在,我得到了以下错误:
自动加载程序期望在文件"/blablabla/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php".中定义的类"Elastica_Query_Bool“找到了文件,但类不在其中,类名或名称空间可能有一个错误。
如果我在我的php文件中将new \Elastica_Query_Bool()更改为new \Elastica\Query\Bool(),它可以正常工作。
但我不明白为什么我现在出了差错。知道吗?
发布于 2013-08-17 23:08:28
因为当您新建Elastica_Query_Bool时,它正在寻找一个名为Elastica_Query_Bool的类。当然,实际的课程叫做Bool。
尝试:
use Elastica\Query\Bool; // At the top of your file following the namespace line.
...
$bool = new Bool();可能需要检查php手册中的命名空间。
https://stackoverflow.com/questions/18294036
复制相似问题