将MongoCursor从-> find()转换为数组 [英] Convert a MongoCursor from ->find() to an array
本文介绍了将MongoCursor从-> find()转换为数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$jokes = $collection->find();
如何将$jokes
转换为数组?
推荐答案
您可以使用PHP的 iterator_to_array
函数,如
You can use PHP's iterator_to_array
function, as suggested in example 1 of the MongoCursor
docs:
$jokes = $collection->find();
$jokesArray = iterator_to_array($jokes);
这篇关于将MongoCursor从-> find()转换为数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文