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


PHP db::instance方法代碼示例

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


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

示例1: dbInstance

 protected static function dbInstance()
 {
     if (NULL == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
開發者ID:neevan1e,項目名稱:Done,代碼行數:7,代碼來源:comments.php

示例2: instance

 public static function instance()
 {
     if (self::$instance == NULL) {
         self::$instance = new db();
     }
     return self::$instance->db;
 }
開發者ID:aic513,項目名稱:Web-programming,代碼行數:7,代碼來源:connect_to_db.php

示例3: get_instance

 public static function get_instance()
 {
     if (is_null(db::$instance)) {
         db::$instance = new db();
     }
     return db::$instance;
 }
開發者ID:RuschGaming,項目名稱:twitch,代碼行數:7,代碼來源:db.php

示例4: getInstance

 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
開發者ID:ViktorHahn,項目名稱:abschluss_projekt,代碼行數:7,代碼來源:class.db.php

示例5: getInstance

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

示例6: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new db();
     }
     return self::$instance;
 }
開發者ID:jstoppo,項目名稱:pazlet.com,代碼行數:7,代碼來源:db.class.php

示例7: init

 public static function init()
 {
     if (self::$instance === null) {
         self::$instance = new db(DB_CONN, DB_USER, DB_PASS);
     }
     return self::$instance;
 }
開發者ID:0-php,項目名稱:AI,代碼行數:7,代碼來源:db.class.php

示例8: GetInstance

 static function GetInstance()
 {
     if (self::$instance == null) {
         self::$instance = new db();
     }
     return self::$instance;
 }
開發者ID:reechani,項目名稱:slydia,代碼行數:7,代碼來源:db.php

示例9: singleton

	public static function singleton($server = null, $username = null, $password = null, $schema = null) {
		if (!isset(self::$instance)) {
			$c = __CLASS__;
			self::$instance = new $c($server, $username, $password, $schema);
		}
		return self::$instance;
	}
開發者ID:rusnewman,項目名稱:db,代碼行數:7,代碼來源:db.class.php

示例10: getInstance

 /**
  * Funcion que usaremos para crear la instancia necesaria para usar la base de datos desde el modelo 
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         //Si no existiera una instancia la crea
         self::$instance = new self();
     }
     return self::$instance;
 }
開發者ID:alexsanro,項目名稱:Practica-Trimestre1,代碼行數:11,代碼來源:db.php

示例11: getInstance

 /**
 *
 * Return DB instance or create intitial connection
 *
 * @return object (PDO)
 *
 * @access public
 *
 */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new PDO("mysql:host=localhost;dbname=exiastore", 'root', '');
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     return self::$instance;
 }
開發者ID:ToyToy00,項目名稱:WelcoM-Project,代碼行數:17,代碼來源:db.dao.php

示例12: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new PDO("mysql:host=localhost;dbname=periodic_table", 'username', 'password');
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     return self::$instance;
 }
開發者ID:newsomc,項目名稱:unify,代碼行數:8,代碼來源:legacy.db.php

示例13: getInstance

 /**
 *
 * Return DB instance or create intitial connection
 *
 * @return object (PDO)
 *
 * @access public
 *
 */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new PDO("mysql:host=localhost;dbname=stoneci2_menuBoard", 'stoneci2_menu', '_P@55word');
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     return self::$instance;
 }
開發者ID:astonecipher,項目名稱:Bar-Menu,代碼行數:17,代碼來源:db.class.php

示例14: instance

 public static function instance()
 {
     if (!isset(self::$instance)) {
         $classname = __CLASS__;
         self::$instance = new $classname();
     }
     return self::$instance;
 }
開發者ID:nobelium,項目名稱:oauth,代碼行數:8,代碼來源:class.db.inc.php

示例15: getInstance

 /**
  * Return DB instance or create intitial connection
  * @return object (PDO)
  * @access public
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new PDO('mysql:host=localhost;dbname=' . DB_NAME, DB_USER_NAME, DB_USER_PASS);
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         self::$instance->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
     }
     return self::$instance;
 }
開發者ID:jamesmcging,項目名稱:Travelling_salesman,代碼行數:14,代碼來源:DB.php


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