php 调用 mongodb
2015-06-26 12:39
597 查看
1、下载phpmongodb 驱动:https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
2、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).
Add the following line to your php.ini file:
extension=php_mongo.dll
3、 例子
<?php
$m = new MongoClient();
$db = $m ->test2;
$collection = $db -> test;
$document = array("title" =>"test","online"=>"true");
$document1 = array("title" =>"test123","online"=>"false");
$collection ->insert($document);
$collection ->insert($document1);
$cursor = $collection ->find();
foreach ($cursor as $doc) {
print_r (@$doc);
}
?>
2、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).
Add the following line to your php.ini file:
extension=php_mongo.dll
3、 例子
<?php
$m = new MongoClient();
$db = $m ->test2;
$collection = $db -> test;
$document = array("title" =>"test","online"=>"true");
$document1 = array("title" =>"test123","online"=>"false");
$collection ->insert($document);
$collection ->insert($document1);
$cursor = $collection ->find();
foreach ($cursor as $doc) {
print_r (@$doc);
}
?>
相关文章推荐
- MongoDB常用操作命令大全
- centos7开机启动mongodb shard cluster
- mongodb集群状态
- MongoDB GridFS
- mongodb 2.6 window 安装启动服务
- python mongodb压力测试脚本
- mongoDB命令
- linux下安装配置mongodb
- MongoDB源码概述——内存管理和存储引擎
- MongoDB源码概述——内存管理和存储引擎
- MongoDB入门篇--增删改查
- mongodb3.1.3安全认证
- Mongodb知识及使用总结(一)
- 8天学通MongoDB——第一天 基础入门
- 利用MongoDB存储scrapy的数据
- mongodb 学习笔记 04 -- 游标、索引
- mongodb维护常用命令
- 【Monkey Run】2015博客keep doing outline
- 用mongodb存储日志
- 10-【MongoDB入门教程】 Journaling日志机制