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


PHP Database::_instance方法代碼示例

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


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

示例1: getInstance

 public static function getInstance()
 {
     if (!self::$_instance instanceof Database) {
         self::$_instance = new Database();
     }
     return self::$_instance;
 }
開發者ID:CodeBooks,項目名稱:php-master-write-cutting-edge-code,代碼行數:7,代碼來源:Singleton.php

示例2: instance

 /**
  * If an instance of this class has been not been instantiated quite yet, this
  * function will create, cache and return the instance. If the instance of
  * this class has already been instantiated and cached, the cached version of
  * this class instantiation will be returned. Thus, adhering to the rules of
  * singleton's.
  *
  * @return Database The singleton instance of this class. Only ever
  *  instantiated but one time.
  */
 public static function instance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:jugglinmike,項目名稱:ae-framework,代碼行數:17,代碼來源:database.php

示例3: getInstance

 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new Database();
     }
     return self::$_instance;
 }
開發者ID:galaxybuster,項目名稱:tsk-mail,代碼行數:7,代碼來源:database.class.php

示例4: singleton

 public static function singleton()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new Database();
     }
     return self::$_instance;
 }
開發者ID:4ZP6Capstone2015,項目名稱:ampersand,代碼行數:7,代碼來源:Database.php

示例5: getInstance

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

示例6: getInstance

 /**
  * Setup the instance (singleton)
  *
  * @param $config array
  * @return Database
  */
 public static function getInstance($config = '')
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self($config);
     }
     return self::$_instance;
 }
開發者ID:Geotex,項目名稱:v6,代碼行數:13,代碼來源:mysqli.class.php

示例7: getInstance

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

示例8: getInstance

 /**
  *	獲得數據庫連接實例對象
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     //echo '輸出實例';
     return self::$_instance;
 }
開發者ID:slyang-git,項目名稱:auto,代碼行數:11,代碼來源:Database.class.php

示例9: start

 /**
  *	Instantiates the singleton.  Checks to make sure there is no instance
  *	already instantiated by looking at the static property $_instance.  If
  *	it doesn't exist, created it.  Otherwise return the handle to this
  *	resource.
  *
  *	Acts as the constructor for this class.
  *
  *	@param		$dbLoc		Location of the MySQL database.
  *	@param		$dbName		Name of the database being used.
  *	@param		$dbUser		Username with access to database.
  *	@param		$dbPass		Password for the database user.
  *	@return		Resource handle
  */
 public static function start($dbLoc, $dbName, $dbUser, $dbPass)
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c($dbLoc, $dbName, $dbUser, $dbPass);
     }
     return self::$_instance;
 }
開發者ID:BGCX067,項目名稱:fairfields-parts-deliveries-svn-to-git,代碼行數:22,代碼來源:Database.class.php

示例10: getInstance

 static function getInstance()
 {
     /*Creates an instance of this object if none exists and returns it.*/
     if (self::$_instance === null) {
         self::$_instance = new Database();
     }
     return self::$_instance;
 }
開發者ID:BigKBear,項目名稱:drive_safe,代碼行數:8,代碼來源:database.php

示例11: getInstance

 public static function getInstance()
 {
     if (self::$_instance === null) {
         $settings = Settings::getInstance();
         self::$_instance = new self($settings->db_host(), $settings->db_name(), $settings->db_user(), $settings->db_pass());
     }
     return self::$_instance;
 }
開發者ID:navvygator,項目名稱:training_creator,代碼行數:8,代碼來源:Database.php

示例12: getInstance

 static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
     //als er al een instantie van de database classe is aangemaakt, dan wordt deze instantie zelf teruggeven (zodat er maar 1 databaseconnectie is).
 }
開發者ID:Diseasedfire,項目名稱:AlaBonteKoe,代碼行數:8,代碼來源:database.class.php

示例13: getInstance

 /**
  * @desc get an instance of the Database
  * @params none
  * @return Instance
  */
 public static function getInstance()
 {
     if (!self::$_instance) {
         // If no instance then make one
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:jncarlson,項目名稱:bluebaron,代碼行數:13,代碼來源:db_class.php

示例14: getInstance

 static function getInstance()
 {
     /*Creates an instance of this object if none exists and returns it.*/
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:BigKBear,項目名稱:whatilearned,代碼行數:8,代碼來源:database_class.php

示例15: getInstance

 public function getInstance()
 {
     if (!isset(self::$_instance)) {
         // :: wywoluje metody klas bez tworzenia instancji obiektow (statyczne wywolanie metody)
         self::$_instance = new Database();
         // wywolujemy instance i przypisujemy
     }
     return self::$_instance;
 }
開發者ID:JolantaWojcik,項目名稱:WebProgramming,代碼行數:9,代碼來源:database.php


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