当前位置: 首页>>代码示例>>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;未经允许,请勿转载。