解析错误:语法错误,第8行的C:\ xampp \ htdocs \ lib \ autors.php中的意外'}'

时间:2013-11-18 22:26:39

标签: mongodb

<?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();

?>

请帮助

2 个答案:

答案 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());

}