[MongoDB] mongodb, php, and mongodbphp. Find the corresponding php version of dll file, [MongoDB] mongodb and php, mongodbphp
Install mongodb php extension on windows
Https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
Find the corresponding php version dll file, download php_cmd.dll, put it in the ext directory under the php installation directory, modify php. ini, and add an extension = php_cmd.dll. no php7-supported dll is found.
Get the publish client object, new
Obtain the database object database, and use the database attribute of the restore client object. for example, $ export client-> database name
Get the collection, and use the collection attribute of the db object, $ db-> set name
Create a collection and call the createCollection () method of the db object,
Call the find () method of the collection object to query data, $ collection-> find ()
Call the update () method of the collection object to update data, $ collection-> update ($ condition, $ data );
Call the insert () method of the collection object to insert data, $ collection-> insert ($ data );
Test; // Obtain the collection $ collection = $ db-> users; // update the document $ condition = array (); $ condition ["id"] = 1; $ data = array (); $ data ['name'] = "wangwu"; $ data ['age'] = "11"; $ collection-> update ($ condition, $ data); // Insert the document $ data = array (); $ data ['id'] = 4; $ data ['name'] = "haha "; $ data ['age'] = "11"; $ collection-> insert ($ data); // delete a document $ condition = array (); $ condition ['id'] = 2; $ collection-> remove ($ condition); // query the document $ users = $ collection-> find (); foreach ($ users as $ k = >V v) {print_r ($ v) ;}?>
Mongodb and php, mongodb installed on windows mongodb php extension https://s3.amazonaws.com/drivers.mongodb.org/php/index.html find the corresponding php version of the dll file ,...