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


PHP DataBase::instance方法代碼示例

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


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

示例1: getInstance

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

示例2: getInstance

 /**
  * Gets an instance of the Database class
  *
  * @static
  * @return Database An instance of the database singleton class.
  */
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new Database();
     }
     return self::$instance;
 }
開發者ID:shachar-b,項目名稱:monopolywebservices,代碼行數:13,代碼來源:DataBase.php

示例3: getInstance

 /**
  *
  * @return DataBase
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
開發者ID:exildev,項目名稱:q-stad,代碼行數:11,代碼來源:mysql.php

示例4: getInstance

 /**
  * Método que garantiza que sólo habrá una instancia de esta clase, con los
  * dos métodos anteriores junto con este, se crea un "Singleton Pattern"
  * con lo cual emulamos lo que sería una clase estática (lo que en java
  * hacemos con "public static class blah {}").
  * (Tomado del manual de php:
  *             http://php.net/manual/en/language.oop5.patterns.php)
  */
 public static function getInstance() {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         $inst = new $c;
         $inst->link = $inst->connect();
         self::$instance = $inst;
     }
     return self::$instance;
 }
開發者ID:narval,項目名稱:modulo_fotos_pinf,代碼行數:17,代碼來源:DataBase.php

示例5: construct

 public static function construct()
 {
     //Si on est en localhost ...
     if ($_SERVER['HTTP_HOST'] == 'localhost') {
         self::$dsn = 'mysql:dbname=gescabmed;host=localhost;charset=UTF8';
         self::$user = 'root';
         self::$psw = '';
     } else {
         self::$dsn = 'mysql:dbname=u298100800_gcm;host=mysql.hostinger.fr';
         self::$user = 'u298100800_root';
         self::$psw = 'azerty';
     }
     //On lance la connexion (objet PDO)
     try {
         self::$instance = new PDO(self::$dsn, self::$user, self::$psw);
     } catch (Execption $e) {
         echo "Erreur connexion PDO" . $e->message;
     }
 }
開發者ID:fauvet,項目名稱:GESCABMED,代碼行數:19,代碼來源:DataBase.php

示例6: _getDb

 private static function _getDb()
 {
     return DataBase::instance(DB_GLOBAL_IP, DB_GLOBAL_PORT, DB_GLOBAL_USER, DB_GLOBAL_PASSWD, DB_GLOBAL_NAME, DB_GLOBAL_LOG);
 }
開發者ID:cmooony,項目名稱:d4d-studio,代碼行數:4,代碼來源:Base.class.php

示例7: array

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '../init.inc.php';
$table = $_REQUEST['table'];
$result = array();
if ($table) {
    $db = DataBase::instance(DB_GLOBAL_IP, DB_GLOBAL_PORT, DB_GLOBAL_USER, DB_GLOBAL_PASSWD, DB_GLOBAL_NAME, DB_GLOBAL_LOG);
    $result = $db->excute("select * from yangfan_cmcc");
}
function javaClassName($str = '', $type = 0)
{
    $arr = split('_', $str);
    $tmp = "";
    foreach ($arr as $i) {
        $tmp .= ucwords($i);
    }
    if ($type == 1) {
        $tmp[0] = strtolower($tmp[0]);
    }
    return $tmp;
}
function jdbcType($str = '', $type = 0)
{
    if (substr($str, 0, 3) == 'int') {
        return "INTEGER";
    }
    if (substr($str, 0, 7) == 'varchar') {
        return "VARCHAR";
    }
    if (substr($str, 0, 4) == 'text') {
        return "LONGVARCHAR";
開發者ID:cmooony,項目名稱:d4d-studio,代碼行數:31,代碼來源:a.php


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