一、下載phpmongodb 驅動:https://s3.amazonaws.com/drivers.mongodb.org/php/index.html php
二、Precompiled binaries for each release are available from » S3 for a variety of combinations of versions, thread safety, and VC libraries. Unzip the archive and put php_mongo.dll in your PHP extension directory ("ext" by default).html
Add the following line to your php.ini file:mongodb
extension=php_mongo.dllhtm
三、 例子 ip
<?phpit
$m = new MongoClient();io
$db = $m ->test2;
$collection = $db -> test;
$document = array("title" =>"test","online"=>"true");thread
$document1 = array("title" =>"test123","online"=>"false");test
$collection ->insert($document);
$collection ->insert($document1);foreach
$cursor = $collection ->find();
foreach ($cursor as $doc) {
print_r (@$doc);
}
?>