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