最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
tp5(thinkPHP5)怎么操作mongoDB数据库
时间:2018-01-22 编辑:猪哥 来源:一聚教程网
本文介绍了tp5(thinkPHP5)操作mongoDB数据库的教程,给有需要的朋友参考一下。
1.通过composer安装
composer require mongodb/mongodb
2.使用
mongoManager = new Manager($this->getUri()); $this->mongoCollection = new Collection($this->mongoManager, "mldn","dept"); } public function test() { // 读取一条数据 $data = $this->mongoCollection->findOne(); print_r($data); } protected function getUri() { return getenv('MONGODB_URI') ?: 'mongodb://127.0.0.1:27017'; } }
-
下一个: python如何方向键控制上下左右
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24