当前位置: 首页>>代码示例>>PHP>>正文


PHP MongoDB::__construct方法代码示例

本文整理汇总了PHP中MongoDB::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoDB::__construct方法的具体用法?PHP MongoDB::__construct怎么用?PHP MongoDB::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoDB的用法示例。


在下文中一共展示了MongoDB::__construct方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(MongoPlus $mongo, $name)
 {
     $this->_mongo = $mongo;
     //		$this->_mongo_id = md5(microtime(1));
     //		$this->ref_mongo($mongo);
     parent::__construct($mongo, $name);
 }
开发者ID:rudiedirkx,项目名称:MongoPlus,代码行数:7,代码来源:MongoPlus.php

示例2: array

 /**
  *	Instantiate class
  *	@param $dsn string
  *	@param $dbname string
  *	@param $options array
  **/
 function __construct($dsn, $dbname, array $options = NULL)
 {
     $this->uuid = \Base::instance()->hash($this->dsn = $dsn);
     $class = class_exists('\\MongoClient') ? '\\MongoClient' : '\\Mongo';
     parent::__construct(new $class($dsn, $options ?: array()), $dbname);
     $this->setprofilinglevel(2);
 }
开发者ID:binarygeotech,项目名称:burgers,代码行数:13,代码来源:mongo.php

示例3: __construct

 /**
  * @param ODM    $odm
  * @param string $name
  * @param array  $config
  */
 public function __construct(ODM $odm, $name, array $config)
 {
     $this->odm = $odm;
     $this->name = $name;
     $this->config = $config + $this->config;
     //Selecting client
     $client = new \MongoClient($this->config['server'], $this->config['options'], isset($this->config['driverOptions']) ? $this->config['driverOptions'] : []);
     parent::__construct($client, $this->config['database']);
 }
开发者ID:spiral,项目名称:components,代码行数:14,代码来源:MongoDatabase.php

示例4: __construct

 /**
  * @param ODM    $odm
  * @param string $name
  * @param array  $config
  */
 public function __construct(ODM $odm, $name, array $config)
 {
     $this->odm = $odm;
     $this->name = $name;
     $this->config = $config + $this->config;
     //Selecting client
     if (class_exists('MongoClient', false)) {
         $this->connection = new \MongoClient($this->config['server'], $this->config['options']);
     } else {
         $this->connection = new \Mongo($this->config['server'], $this->config['options']);
     }
     parent::__construct($this->connection, $this->config['database']);
 }
开发者ID:tuneyourserver,项目名称:components,代码行数:18,代码来源:MongoDatabase.php

示例5: __construct

 /**
  * @param \MongoClient|string|array $client  Client or settings
  * @param string                    $name
  */
 public function __construct($client, $name = null)
 {
     if (is_array($client) || is_object($client) && !$client instanceof \MongoClient) {
         $options = (array) $client;
         $name = isset($options['database']) ? $options['database'] : null;
         $server = $options['client'];
         if (!strpos($options['client'], '/') && isset($name)) {
             $server .= '/' . $name;
         }
         unset($options['client'], $options['database']);
         $client = new \MongoClient($server, $options);
     }
     if (is_string($client)) {
         $client = new \MongoClient($client);
     }
     parent::__construct($client, $name);
     $this->mongoClient = $client;
 }
开发者ID:jasny,项目名称:db-mongo,代码行数:22,代码来源:DB.php

示例6: array

 /**
  *	Instantiate class
  *	@param $dsn string
  *	@param $dbname string
  *	@param $options array
  **/
 function __construct($dsn, $dbname, array $options = NULL)
 {
     $class = class_exists('\\MongoClient') ? '\\MongoClient' : '\\Mongo';
     parent::__construct(new $class($dsn, $options ?: array()), $dbname);
     $this->setprofilinglevel(2);
 }
开发者ID:Mumcio,项目名称:bookmark-manager,代码行数:12,代码来源:mongo.php

示例7: __construct

 public function __construct($conn, $name)
 {
     $this->conn = $conn;
     $this->name = $name;
     parent::__construct($conn, $name);
 }
开发者ID:lisong,项目名称:incubator,代码行数:6,代码来源:Db.php

示例8: __construct

 /**
  * Constructor.
  *
  * @param \Mongator\Logger\LoggableMongo $mongo A LoggableMongo instance.
  * @param string                         $name  The database name.
  */
 public function __construct($mongo, $name)
 {
     $this->mongo = $mongo;
     $this->time = new Time();
     return parent::__construct($mongo, $name);
 }
开发者ID:mongator,项目名称:mongator,代码行数:12,代码来源:LoggableMongoDB.php

示例9: __construct

 /**
  * MongoDB constructor.
  * @param \MongoClient $conn
  * @param string $name
  * @param CacheInterface $cache
  */
 public function __construct(\MongoClient $conn, $name, CacheInterface $cache)
 {
     parent::__construct($conn, $name);
     $this->cache = $cache;
 }
开发者ID:nicklasos,项目名称:MongoCache,代码行数:11,代码来源:MongoDB.php

示例10: array

 /**
  * @param Config $config
  */
 function __construct(Config $config)
 {
     $client = new \MongoClient('mongodb://' . $config->MongoDb->host, array('username' => $config->MongoDb->user, 'password' => $config->MongoDb->password, 'db' => $config->MongoDb->db));
     parent::__construct($client, $config->MongoDb->db);
 }
开发者ID:mongular,项目名称:mongular,代码行数:8,代码来源:Db.php


注:本文中的MongoDB::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。