Home > Backend Development > PHP Tutorial > mongo数据库,该如何处理

mongo数据库,该如何处理

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:09:36
Original
885 people have browsed it

mongo数据库
如何测试mongo数据库是否连接上?
  今天刚接触mongodb。不太熟悉。
  有没有这方面的学习资料?
  谢谢!

------解决方案--------------------

PHP code
<?php class Model{        public function creat(){            $mongo = new Mongo('……');            $db = $mongo->selectDB('fish_test'); //如无数据库则会自动创建            $collection=$db->selectCollection('fish');//如无数据库表则会自动创建                    $record=array(                'name'=>'fish',                'time'=>'123',                'StartTime'=>'456',            )            $collection->save($record);//添加 新记录        }            }?><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template