0
$m = new MongoClient();
$db = $m->selectDB('twitter');
$collection = new MongoCollection($db, 'status');
$cursor = $collection->find();
foreach ($cursor as $document) {
echo $document['statuses'][0]['text'];
}
陣:
Array
(
[_id] => MongoId Object
(
[$id] => 123
)
[statuses] => Array
(
[0] => Array
(
[text] => Tweet no 1
)
[1] => Array
(
[text] => Tweet no 2
)
[1] => Array
(
[text] => Tweet no 3
)
)
)
輸出:鳴叫沒有1.
如何獲得整個 '文本' 數組?它應該返回'Tweet no 1,Tweet no 2,Tweet no 3'。我試過echo $document['statuses']['text']
,但不起作用。