本文整理匯總了PHP中Connect::instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connect::instance方法的具體用法?PHP Connect::instance怎麽用?PHP Connect::instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Connect
的用法示例。
在下文中一共展示了Connect::instance方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new PDO("odbc:driver={SQL Server}" . ";Server=" . self::$host . ";Database=" . self::$database . ";Uid=" . self::$user . ";Pwd=" . self::$pass . ";");
}
return self::$instance;
}
示例2: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new PDO('mysql:host=localhost;dbname=db_phpeste;', 'root', 'livre', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$instance->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING);
}
return self::$instance;
}
示例3: getInstance
public static function getInstance($name, $host, $user, $pass)
{
if (!isset(self::$instance)) {
$nameClass = __CLASS__;
self::$instance = new $nameClass();
include "ClassConnect.php";
$con = new db_mysql();
self::$status = $con->conectar($name, $host, $user, $pass);
}
return self::$instance;
}
示例4: getInstance
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new Connect();
self::$connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
$select_db = @mysql_select_db(DB_NAME, self::$connection);
if (!$select_db || !self::$connection) {
//Handle Error
header("Location: http://www.google.com");
die("Connection Error");
}
}
return self::$instance;
}
示例5: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new PDO("pgsql:dbname=" . self::$database . "host=" . self::$host, self::$user, self::$pass);
/*self::$instance = new PDO(
"odbc:driver={SQL Server}" .
";Server=" . self::$host .
//":" . self::$door .
";Database=" . self::$database .
";Uid=" . self::$user .
";Pwd=" . self::$pass . ";"
);*/
}
return self::$instance;
}