1
如何在php 7中使用mongodb创建集合?如何在php 7中创建集合?
我试过,
$collection = new CreateCollection($sessionid);
,但它给我的错误是,类CreateCollection没有找到
如何在php 7中使用mongodb创建集合?如何在php 7中创建集合?
我试过,
$collection = new CreateCollection($sessionid);
,但它给我的错误是,类CreateCollection没有找到
,它是如何工作的不是。您应该使用功能CreateCollection in the MongoDB class。
$mongo = new MongoClient();
$db = new MongoDB($mongo, 'The name of your database');
$db->createCollection("sessionid");
Ans给你的是它的工作对于PHP 5我的问题是PHP 7(通过PHongo技术)。 – Mayuri
然后就不需要创建集合,只需将它用于'$ collection =(new MongoDB \ Client) - > yourdatabase-> yourcollection;' – user3807877