时间:2021-07-01 10:21:17 帮助过:8人阅读
Deprecated: main(): The Mongo class is deprecated, please use the MongoClient class
反对:main():Mongo类是过时的,请使用mongoclient类
echo "mongo contact:
";
//$DB = new PDO("mongodb:host=localhost;port=27017;dbname=aaa","admin","admin");
$conn = new MongoClient("mongodb://admin:admin@localhost2:27017/local");
?>
错误提示
mongo contact:
( ! ) Fatal error: Uncaught exception 'MongoConnectionException' with message 'MongoClient::__construct(): ' in D:\bzyweb\test2\conn.php on line 4
( ! ) MongoConnectionException: MongoClient::__construct(): in D:\bzyweb\test2\conn.php on line 4
Call Stack
# Time Memory Function Location
1 0.0000 240416 {main}( ) ..\conn.php:0
2 0.0000 240672 __construct ( ) ..\conn.php:4
你的下图是什么?mongo 管理器?
你看看他是怎么写的
下图是一个mongoweb的管理地址,我看了好多写法,好像链接都是那么写的,不清楚为什么我的出错了,所以贴出来数据库的结构,我想这样能表述的更清晰一点
$dsn="mongodb://localhost:27017/admin:admin/aaa";
$m=new MongoClient($dsn);
没有报错了