0
这是我在尝试将数据从MongoDB
查看到网页时发生的错误。 在Windows中使用Wamp
:可捕捉的致命错误:类MongoCursor的对象无法转换为字符串
Catchable fatal error: Object of class MongoCursor could not be converted to string
是什么意思,我应该怎么办?
这是我在尝试将数据从MongoDB
查看到网页时发生的错误。 在Windows中使用Wamp
:可捕捉的致命错误:类MongoCursor的对象无法转换为字符串
Catchable fatal error: Object of class MongoCursor could not be converted to string
是什么意思,我应该怎么办?
我figuredout所述的方法,以消除错误检查此代码
<?php
// connect to mongodb
$m = new MongoClient();
$db = $m->local; \t \t \t \t // select a database
$collection = $db->directors; // select a collection (table in old DB)
$cursor = $collection->find(); // view all
foreach ($cursor as $doc)
{
var_dump($doc);
}
?>
在上面的代码中var_dump()
功能用于显示的值或变量,所以如果数据类型你使用它,这也可以给你一个详细的信息在这种情况下你的数据的大小和长度,并显示结果也。
这段代码是关于如何从MongoDB获取价值并显示在PHP页面上。