Article From:https://segmentfault.com/q/1010000012151162
Question:

1.LinuxThe mongodb class is instantiated.

<?php
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
var_dump($manager);

2.windowThe mongodb class is instantiated.

 $ip = "127.0.0.1";
 $port = '27017';
 $dns = 'mongodb://'.$ip.':'.$port;
 $manager = new \MongoClient($dns);
 var_dump($manager);     

3.Is a program instantiation divided into operating systems, so that the development environment and production environment need not be unified?

Answer 0:

Nothing to do with the operating system. This is the problem of mongodb extension that you install.
The two platforms use a set of extended libraries without changing code.

Answer 1:

You were the two version that you used to use.
The second version is the form I’m using now. Windows, MAC, Linux general-purpose

Answer 2:

LinuxDo you use second ways to report errors, or do you use the first method to report errors on window?
Otherwise how do you know it’s not uniform

Leave a Reply

Your email address will not be published. Required fields are marked *