Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.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 调用未定义的方法MongoDB\Driver\Cursor::current()_Php_Mongodb - Fatal编程技术网

Php 调用未定义的方法MongoDB\Driver\Cursor::current()

Php 调用未定义的方法MongoDB\Driver\Cursor::current(),php,mongodb,Php,Mongodb,我在PHP中遇到以下错误: Fatal error: Uncaught Error: Call to undefined method MongoDB\Driver\Cursor::current()`. 这似乎与我的观点相矛盾 我可以显示我的代码,但是,我调用了MongoDB游标的方法current()。这项功能几周前刚刚添加: MongoDB\Driver\Cursor过去只实现了Traversable,并提供了一个内部迭代器(不适用于迭代器userland类)。PHP8要求我们直接实现迭

我在PHP中遇到以下错误:

Fatal error: Uncaught Error: Call to undefined method MongoDB\Driver\Cursor::current()`.
这似乎与我的观点相矛盾


我可以显示我的代码,但是,我调用了MongoDB游标的方法
current()

这项功能几周前刚刚添加:

MongoDB\Driver\Cursor过去只实现了Traversable,并提供了一个内部迭代器(不适用于迭代器userland类)。PHP8要求我们直接实现迭代器或迭代器聚合(PHPC-1690),尽管PHP也为扩展提供了一个内部迭代器,使之更容易实现

这样说,我们应该考虑在光标上提供一个适当的迭代器实现,以消除对PHP 8内部迭代器类的依赖性,并为所有支持的版本提供一致的API。 (2020年11月4日决议)


确保您拥有的所有软件包都是最新的,或者在必要时是最新的。

您的mongodb版本是什么(以防万一)?我的版本是4.2.9