The example of this article describes the simple operation of Php MongoDB method. Share to everyone for your reference, specific as follows:
PHP operation MongoDB First download the MongoDB expansion pack from the Internet, https://github.com/mongodb/mongo-php-driver/downloads, select the corresponding expansion package.
This is my next, then decompression, VC6 fit apache,vc9 suitable for iis,ts (thread safe) refers to PHP as a modular form of operation.
Then put the Php_mongo.dll in PHP in the Ext folder, and then add Extension=php_mongo.dll in the php.ini, restart Apache.
The package for the PHP extension MongoDB is installed.
About query MongoDB Some use functions to query manuals http://us.php.net/manual/en/class.mongocollection.php
<?php error_reporting (7); $conn = new Mongo (); $db = $conn->phpdatabase; $collectio
n = $db->phpcollection; /*-----------------------------* Delete *-----------------------------$collection->remove ("name" =>)
xixi111 ")); */*------------------------------*------------------------------for ($i = 0; $i <= $i + +) {$data = array ( "Name" => "Xixi". $i, "email" => "673048143_". $i. "
@qq. com "," Age "=> $i *1+20);
$collection->insert ($data); * *////*-------------------------------* Find *-------------------------------$res = $collection->find (Array ("Age" =& Gt
Array (' $GT ' =>, ' $lt ' =>)), Array ("name" => true)); foreach ($res as $v) {print_r ($v);}//*-------------------------------* update *-------------------------------$coll
Ection->update (Array ("Age" =>22), Array (' $set ' => Array ("name" => "Demoxixi")); */?>
More interested in PHP related content readers can view the site topics: "PHP+MONGODB Database Operation Skills Encyclopedia", "PHP based on PDO Operation Database Skills summary", "PHP object-oriented Program Design Introduction Tutorial", "PHP string (String) Usage Summary", " Introduction to PHP+MYSQL Database operations and a summary of PHP common database operations Tips
I hope this article will help you with the PHP program design.