當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Db::_instance方法代碼示例

本文整理匯總了PHP中Db::_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Db::_instance方法的具體用法?PHP Db::_instance怎麽用?PHP Db::_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Db的用法示例。


在下文中一共展示了Db::_instance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getInstance

 public static function getInstance()
 {
     if (!self::$_instance) {
         // If no instance then make one
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:kadrim1,項目名稱:net_bank,代碼行數:8,代碼來源:Db.php

示例2: getInstance

 /**
  * 創建db對象
  */
 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new Db();
     }
     return self::$_instance;
 }
開發者ID:timerlau,項目名稱:yaf_ericore,代碼行數:10,代碼來源:Db.php

示例3: instance

 /**
  * @return Db
  */
 public static function instance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = self::factry();
     }
     return self::$_instance;
 }
開發者ID:BGCX261,項目名稱:zlskytakeorder-svn-to-git,代碼行數:10,代碼來源:Db.class.php

示例4: getInstance

 /**
  * 取得數據庫類實例
  * @static
  * @access public
  * @return mixed 返回數據庫驅動類
  */
 public static function getInstance($db_config = '')
 {
     if (self::$_instance == null) {
         self::$_instance = new Db($db_config);
     }
     return self::$_instance;
 }
開發者ID:songhongyu,項目名稱:THINKSNS,代碼行數:13,代碼來源:Db.class.php

示例5: getInstance

 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new PDO('mysql:host=localhost;dbname=localization;charset=utf8;"', 'root', 'sera');
     }
     return self::$_instance;
 }
開發者ID:OmniPot,項目名稱:SoftUni-Level-3-Backend,代碼行數:7,代碼來源:Db.php

示例6: getInstance

 public static function getInstance($which_db = 'model')
 {
     if (self::$_instance == null) {
         self::$_instance = self::_connect($which_db);
     }
     return self::$_instance;
 }
開發者ID:retorick,項目名稱:toewsweb,代碼行數:7,代碼來源:Db.php

示例7: getInstance

 /**
  * Статическая функция, которая возвращает
  * экземпляр класса или создает новый при
  * необходимости
  * @return Db
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:iScepsis,項目名稱:flippy,代碼行數:13,代碼來源:db.class.php

示例8: getInstance

 /**
  * 獲取數據庫單例實例
  *
  * @return object self
  * @author Seven Du <lovevipdsw@vip.qq.com>
  **/
 public static function getInstance($config = null)
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self($config);
     }
     return self::$_instance;
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:13,代碼來源:Db.class.php

示例9: getInstance

 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:adanwaky,項目名稱:practica1,代碼行數:7,代碼來源:bd_model.php

示例10: getInstance

 /**
  * Get Db object instance (Singleton)
  *
  * @return object Db instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new MySQL();
     }
     return self::$_instance;
 }
開發者ID:sealence,項目名稱:local,代碼行數:12,代碼來源:Db.php

示例11: getInstance

 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         return self::$_instance = new self();
     } else {
         return self::$_instance;
     }
 }
開發者ID:autoDes,項目名稱:smth,代碼行數:8,代碼來源:Db.php

示例12: getInstance

 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new PDO("mysql:host=localhost;dbname=translations", "root", "");
         self::$_instance->query("SET NAMES utf8");
     }
     return self::$_instance;
 }
開發者ID:premiera85,項目名稱:SoftUni,代碼行數:8,代碼來源:Db.php

示例13: conectar

 private function conectar()
 {
     $this->link = "mysql:host={$this->servidor};dbname={$this->base_datos}";
     try {
         self::$_instance = new PDO($this->link, $this->username, $this->passwd);
     } catch (PDOException $e) {
         echo "error: " . $e->getMessage();
     }
 }
開發者ID:jortiz-el,項目名稱:PhP,代碼行數:9,代碼來源:Db.php

示例14: getInstance

 public static function getInstance()
 {
     // If no instance then make one
     if (!self::$_instance) {
         //echo( "New connection<br>" );
         Logger::write("DEBUG", "New connection");
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:jmitsakos,項目名稱:benismits-kano,代碼行數:10,代碼來源:db_connect.php

示例15: getInstance

 public static function getInstance(array $config)
 {
     if (empty($config)) {
         throw new SixException("請傳入正確的數據庫參數!", 1);
     }
     $this->_config = array_filter($config);
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:shacaisheng,項目名稱:Pdo-Mysql-Database,代碼行數:11,代碼來源:Db.php


注:本文中的Db::_instance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。