本文整理汇总了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'));
}
}