-
php_mongo.dll 适用于php5.2 5.3各种版本下载
资源介绍
[PHP 5.2 VC6 Non-Thread-Safe Mongo extensi
[PHP 5.2 VC6 Thread-Safe Mongo extension]
[PHP 5.3 VC6 Non-Thread-Safe Mongo extensi
[PHP 5.3 VC6 Thread-Safe Mongo extension]
[PHP 5.3 VC8 Non-Thread-Safe Mongo extensi
[PHP 5.3 VC8 Thread-Safe Mongo extension]
[PHP 5.3 VC9 Thread-Safe Mongo extension]
解决 php_mongo.dll模块不能加载
在PHP中安装php_mongo.dll的扩展中,遇到 mongo.dll加载不了,
1.检查了下自己PHP版本为5.2,检查到原因php_mongo.dll与PHP版本不匹配,
2.重新在https://github.com/mongodb/mongo-php-driver/downloads下载了mongo-1.1.4.zip
3.解压mongo-1.1.4.zip\mongo-1.1.4-php5.2vc6ts ,
4.将php_mongo.dll覆盖D:\wamp\bin\php\php5.2.9-1\ext\php_mongo.dll,
5.重启apache,安装OK。
找到代码:
<?php
$mongo_server_name = 'admin';
$mongo_server_pwd = 'admin';
// 连接Mongo数据库 数据库地址:端口/账号:密码;
$mongo = new Mongo('mongodb://localhost:27017/admin:admin');
// 选择一个数据库和要操作的集(如果没有数据库默认创建)
//$collection = $mongo->selectDB('hf_note')->selectCollection('AccessaLog'); //方法一
$collection = $mongo->selectCollection('hf_note', 'AccessaLog'); //方法二
$dataList = $collection->find();
foreach ($dataList as $key => $val)
{
var_dump($val);
}
运行结果:
array '_id' =>object(MongoId)[7] public '$id' =>string'4f570e3775b7e117a0b38ef6'(length=24) 'username' =>string'lijunhua'(length=8) 'password' =>string'123456'(length=6) 'sex' =>string'male'(length=4) 'age' =>int27array '_id' =>object(MongoId)[8] public '$id' =>string'4f570f4175b7e117a0b38ef7'(length=24) 'username' =>string'harris'(length=6) 'password' =>string'harris'(length=6) 'sex' =>string'male'(length=4) 'age' =>int28array '_id' =>object(MongoId)[7] public '$id' =>string'4f570f9c75b7e117a0b38ef8'(length=24) 'username' =>string'amdin'(length=5) 'password' =>string'admin'(length=5) 'sex' =>string'male'(length=4) 'age' =>int27
- 上一篇: IEEE-6 14 30节点系统 MATLAB 潮流计算
- 下一篇: DB_常用命令_Oracle