Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.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_Php 8 - Fatal编程技术网

Php MongoDB\Driver\Cursor::current()不返回任何内容,但应该返回

Php MongoDB\Driver\Cursor::current()不返回任何内容,但应该返回,php,mongodb,php-8,Php,Mongodb,Php 8,我用的是PHP8 var_转储(get_类($usernameInDb))返回字符串(21)“MongoDB\Driver\Cursor” var_dump($usernameInDb)显示存在一个文档 $avier=$usernameInDb->current()不会在error.log中导致PHP错误 var_dump($avierr)返回int(8)字符串(26)“未定义变量:avier” 在我看来,这似乎与 有人知道发生了什么吗?这应该是固定的 $avier未定义,因为$username

我用的是PHP8

var_转储(get_类($usernameInDb))返回
字符串(21)“MongoDB\Driver\Cursor”

var_dump($usernameInDb)显示存在一个文档

$avier=$usernameInDb->current()不会在error.log中导致PHP错误

var_dump($avierr)返回
int(8)字符串(26)“未定义变量:avier”

在我看来,这似乎与

有人知道发生了什么吗?

这应该是固定的

$avier
未定义,因为
$usernameInDb->current()
未处理导致
$avier
处于无效状态的无效位置

如果你这样做

var_dump($cursor->current());
echo gettype($cursor->current());
输出将是

UNKNOWN:0
unknown type
这是处理未知数据类型的方法