本文整理汇总了PHP中Mysql::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::instance方法的具体用法?PHP Mysql::instance怎么用?PHP Mysql::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::instance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnection
public static function getConnection()
{
if (!isset(self::$instance)) {
self::$instance = new Mysql(false);
}
return self::$instance;
}
示例2: getInstance
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new Mysql();
}
return self::$instance;
}
示例3: getInstance
public static function getInstance($dbHost)
{
if (!Mysql::$instance) {
Mysql::$instance = new Mysql($dbHost);
}
return Mysql::$instance;
}
示例4: getInstance
static function getInstance($dbHost, $dbName, $dbUser, $dbPass) {
if(!Mysql::$instance) {
Mysql::$instance = new Mysql($dbHost, $dbName, $dbUser, $dbPass);
}
return Mysql::$instance;
}
示例5: get_instance
/**
* Return a singleton instance
*
* @param null $config
*
* @return Mysql Singleton Reference
* @throws MySQLException
* @throws \Exception
*/
public static function get_instance($config = null)
{
try {
if (is_null(self::$instance)) {
self::$instance = new Mysql($config);
}
} catch (MySQLException $e) {
throw $e;
}
return self::$instance;
}
示例6: disconnect
public function disconnect()
{
if ($this->_mysql_link) {
mysql_close($this->_mysql_link);
$this->_mysql_link = null;
}
self::$instance = null;
}
示例7: getInstance
public static function getInstance($id)
{
if (!$id) {
foreach (Model::getConnectionsData() as $k => $v) {
if ($v['type_db'] == "mysql") {
$id = $k;
break;
}
}
}
Debug::log("getInstance Mysql.", __LINE__, __FUNCTION__, __CLASS__, __FILE__);
if (!isset(self::$instance) || !is_object(self::$instance)) {
$class = __CLASS__;
self::$instance = new $class($id);
}
if (!isset(self::$connection[$id])) {
self::$instance->newConnection($id);
}
return self::$instance;
}
示例8: get_instance
/** static public function get_instance
* Returns the singleton instance
* of the MySQL Object as a reference
*
* @param array optional configuration array
* @action optionally creates the instance
* @return MySQL Object reference
*/
public static function get_instance($config = null)
{
try {
if (is_null(self::$instance)) {
self::$instance = new Mysql($config);
}
self::$instance->test_connection();
self::$instance->_log(__METHOD__ . ' --------------------------------------');
} catch (MySQLException $e) {
throw $e;
}
return self::$instance;
}