首先需要下载MongoDB的PHP驱动,配置驱动以便在PHP环境使用

$connection = new Mongo( “localhost:27017” ); 
$collection = $connection->prefs->location; 
$cursor = $collection->find();
foreach ($cursor as $id => $value) {
    echo “$id: “;
    var_dump( $value ); 
}

results matching ""

    No results matching ""