<?php
$connection = new Mongo();
$database = $connection->selectDB('lib');
$collection = $database->selectCollection('autor'); } catch(MongoConnectionException $e) {
die("Failed to connect to database ".$e->getMessage());
}
$cursor = $collection->find();
?>
请帮助
答案 0 :(得分:1)
我在“catch”之前看到一个},但不是在你打开块的地方尝试。
答案 1 :(得分:0)
try {
$connection = new Mongo();
$database = $connection->selectDB('lib');
$collection = $database->selectCollection('autor');
}
catch(MongoConnectionException $e) {
die("Failed to connect to database ".$e->getMessage());
}