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