本文整理匯總了PHP中MySQL::_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP MySQL::_instance方法的具體用法?PHP MySQL::_instance怎麽用?PHP MySQL::_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MySQL
的用法示例。
在下文中一共展示了MySQL::_instance方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInstance
/**
* Get singelton instance
*
* @return MySQL
*/
public static function getInstance()
{
if (!isset(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
示例2: getInstance
public static function getInstance($host = '', $name = '', $pwd = '', $dBase = '')
{
if (FALSE == self::$_instance instanceof self) {
self::$_instance = new self($host, $name, $pwd, $dBase);
}
return self::$_instance;
}
示例3: MySQL
/**
* Создаёт, либо возвращает единственный экземпляр MyQSL
*
* @param string $server
* @param string $user
* @param string $password
*/
public static function &creator($server, $user, $password)
{
if (self::$_instance == NULL) {
self::$_instance = new MySQL($server, $user, $password);
}
return self::$_instance;
}
示例4: GetInstance
static function GetInstance($host, $user, $password, $database)
{
if (self::$_instance == null || self::$mysqli != null) {
self::$_instance = new MySQL();
self::$mysqli = new mysqli($host, $user, $password, $database);
if (mysqli_connect_errno()) {
printf("數據庫連接失敗!:%s\n", mysqli_connect_error());
}
}
return self::$_instance;
}
示例5: getInstance
/**
* Singleton accessor to the database instance
* -- change this to use a md5 on the $params to allow for multiple single instances
*/
public static function getInstance($params = NULL)
{
if (self::$_instance == NULL) {
self::$_instance = new MySQL($params);
}
return self::$_instance;
}