版本为:
7.0.31
1.5.1
3.4.16
$manager = new MongoDB\Driver\Manager("mongodb://username:password@localhost:27017/database");
var_dump($manager);
/var/www/html/file/mongocall.php:12:
object(MongoDB\Driver\Manager)[1]
public 'uri' => string 'mongodb://username:password@localhost:27017/database' (length=53)
public 'cluster' =>
array (size=0) empty
执行后得到结果
composer require mongodb/mongodb
require 'vendor/autoload.php';
$m= new MongoDB\Client("mongodb://127.0.0.1/");