Blogger Information
Blog 5
fans 0
comment 0
visits 3316
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP链接MongoDB
瞬间
Original
589 people have browsed it

class Mongo

{

private static $client;

private static $mongoDb;

private function __construct()

{

self::$client = new \MongoDB\Driver\Manager("mongodb://账号:密码@ip:端口");

}

private function __clone()

{

}

public static function get_instance()

{

if(!self::$mongoDb instanceof self){

return new self();

}

return self::$mongoDb;

}

public static function get_client()

{

return self::$client;

}

}


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post