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


PHP Db::instance方法代碼示例

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


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

示例1: get

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

示例2: save

 public function save()
 {
     $db = Db::instance();
     // map database fields to class properties; omit id and dateCreated
     $db_properties = array('email' => $this->email, 'name' => $this->name);
     $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);
 }
開發者ID:malimu,項目名稱:Pipeline,代碼行數:7,代碼來源:consent.class.php

示例3: getDbInstance

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

示例4: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self(['database_type' => 'mysql', 'database_name' => 'notificador', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'charset' => 'utf8']);
     }
     return self::$instance;
 }
開發者ID:ulissesvaquero,項目名稱:slim-medoo-rest-api,代碼行數:7,代碼來源:db.php

示例5: singleton

 public static function singleton()
 {
     if (self::$instance == false) {
         self::$instance = new parent(Config::host, Config::username, Config::pass, Config::dbname);
     }
     return self::$instance;
 }
開發者ID:Adriangel,項目名稱:omegame,代碼行數:7,代碼來源:Db.php

示例6: getInstance

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

示例7: save

 public function save()
 {
     $db = Db::instance();
     // map database fields to class properties; omit id and dateCreated
     $db_properties = array('description' => $this->description, 'group' => $this->group, 'css_class' => $this->cssClass, 'diffable' => $this->diffable, 'hidden' => $this->hidden, 'contribution' => $this->contribution);
     $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);
 }
開發者ID:malimu,項目名稱:Pipeline,代碼行數:7,代碼來源:eventType.class.php

示例8: getInstance

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

示例9: getInstance

 /**
  *   Singleton
  */
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
開發者ID:pixelproduction,項目名稱:PixelManagerCMS,代碼行數:10,代碼來源:Db.php

示例10: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
     }
     return self::$instance;
 }
開發者ID:bsack23,項目名稱:mvc-hwredo,代碼行數:7,代碼來源:db.class.php

示例11: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new PDO('mysql:host=' . _DB_HOST_ . ';dbname=' . _DB_NAME_, _DB_USER_, _DB_PASS_, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
     }
     return self::$instance;
 }
開發者ID:ADcreatif,項目名稱:wardieval,代碼行數:7,代碼來源:Db.class.php

示例12: save

 public function save()
 {
     $db = Db::instance();
     // map database fields to class properties; omit id and dateCreated
     $db_properties = array('user_id' => $this->userID, 'title' => $this->title, 'slug' => $this->slug);
     $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);
 }
開發者ID:malimu,項目名稱:Pipeline,代碼行數:7,代碼來源:interest.class.php

示例13: getDBInstance

 public static function getDBInstance()
 {
     if (self::$instance == null) {
         self::$instance = self::initiatePDOObject();
     }
     return self::$instance;
 }
開發者ID:dvertovsek,項目名稱:iOS-PHP-PostgreSQL-ChatApp,代碼行數:7,代碼來源:dbPDOController.php

示例14: getInstance

 static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = self::buildInstance();
     }
     return self::$instance;
 }
開發者ID:nicolaslattuada,項目名稱:minimal-php-mvc,代碼行數:7,代碼來源:Db.php

示例15: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Db(_DB_SERVER_NAME_, _DB_USER_NAME_, _DB_PASSWORD_, _DB_NAME_);
     }
     return self::$instance;
 }
開發者ID:ecuation,項目名稱:Control-de-stock,代碼行數:7,代碼來源:Db.php


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