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