To install MongoDB, refer to my article on operating MongoDB in C.
For PHP, first download the MongoDB extension package from the Internet, https://github.com/mongodb/developer-php-driver/downloads, and select the corresponding expansion package.
This is my example, and decompress it. vc6 is suitable for Apache, vc9 is suitable for IIS, and TS (thread safe) means PHP runs in the form of modules.
Put php_cmd.dll In the ext folder of PHP, add extension = php_cmd.dll to PhP. ini, and restart Apache.
So far, the PHP MongoDB extension package has been installed.
About querying MongoDB some use functions can be queried manual http://us.php.net/manual/en/class.mongocollection.php
<PRE>
<? PHP
Error_reporting (7 );
$ Conn = new Mongo ();
$ Db = $ Conn-> phpdatabase;
$ Collection = $ db-> phpcollection;
/*-----------------------------
* Delete
*-----------------------------
$ Collection-> remove (Array ("name" => "xixi111 "));
*/
/*------------------------------
* Insert
*------------------------------
For ($ I = 0; $ I <= 50; $ I ++ ){
$ DATA = array ("name" => "Xixi ". $ I, "email" => "673048143 _". $ I. "@ QQ.com", "Age" => $ I * 1 + 20 );
$ Collection-> insert ($ data );
}
*/
/*-------------------------------
* Search
*-------------------------------
$ Res = $ collection-> Find (Array ("Age" => array ('$ GT' => 25, '$ lt' => 40 )), array ("name" => true ));
Foreach ($ res as $ v ){
Print_r ($ V );
}
*/
/*-------------------------------
* Update
*-------------------------------
$ Collection-> Update (Array ("Age" => 22), array ('$ set' => array ("name" => "demoxixi ")));
*/
?>