本文整理匯總了PHP中DataBase::db方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataBase::db方法的具體用法?PHP DataBase::db怎麽用?PHP DataBase::db使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataBase
的用法示例。
在下文中一共展示了DataBase::db方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInstance
/**
* Instantiator static method
* As of PHP 5.3.0, PHP implements a feature called late static bindings which
* can be used to reference the called class in a context of static inheritance.
* @return MySQLi
*/
public static function getInstance()
{
if (!is_object(self::$db)) {
self::$db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
}
return self::$db;
}
示例2: getDBO
public static function getDBO()
{
if (self::$db == null) {
self::$db = new DataBase(Config::DB_HOST, Config::DB_USER, Config::DB_PASSWORD, Config::DB_NAME);
}
return self::$db;
}
示例3: getDB
public static function getDB()
{
if (self::$db == null) {
self::$db = new DataBase();
}
return self::$db;
}
示例4: getDB
public static function getDB()
{
if (self::$db == null) {
self::$db = new DataBase(Config::DB_HOST, Config::DB_USER, Config::DB_PASSWORD, Config::DB_NAME, Config::DB_PREFIX, Config::DB_CHARSET, Config::DB_LOCALE);
}
return self::$db;
}
示例5: init
public static function init($dbSettings = null)
{
if (!self::$db) {
self::$db = new DataBase($dbSettings);
}
return self::$db;
}
示例6: getInstance
public static function getInstance($dsn, $user, $password)
{
self::$db = new DataBase($dsn, $user, $password);
return self::$db;
}
示例7: _connect
public static function _connect()
{
if (!self::$db) {
self::$db = new PDO('mysql:host=' . Config::get('DB_HOST') . ';dbname=' . Config::get('DB_DATABASE') . ';charset=' . Config::get('DB_CHARSET'), Config::get('DB_USER'), Config::get('DB_PASSWORD'));
}
}