我想用蒙戈DB與PHP的,所以我已經安裝了驅動程序和顯示,以及在phpinfo()
蒙戈DB PHP驅動程序致命錯誤
問題是,當我嘗試連接在這裏,我得到致命錯誤。
Fatal error: Uncaught Error: Class 'MongoDB\Client' not found
這裏是我如何連接
$mongo = new \MongoDB\Client('mongodb://user:[email protected]/chat');
try
{
$dbs = $mongo->listDatabases();
print_r($dbs);
}
這裏是我安裝的擴展sudo apt-get install php7.0-mongodb
我也遵循了這一http://php.net/manual/en/mongodb.tutorial.library.php 任何幫助!
我跟着這個http://php.net/manual/en/mongodb.tutorial.library.php –
請編輯問題,而不是評論它。還要添加您用來安裝擴展的命令。 'MongoDB \ Client'來自現在已過時的舊版庫。 –
完成後,我編輯了我的問題... –