本文整理汇总了PHP中DB_CONNECT::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_CONNECT::getHost方法的具体用法?PHP DB_CONNECT::getHost怎么用?PHP DB_CONNECT::getHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_CONNECT
的用法示例。
在下文中一共展示了DB_CONNECT::getHost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$DB_CONNECT = new DB_CONNECT();
$this->connection = new \mysqli($DB_CONNECT->getHost(), $DB_CONNECT->getUsername(), $DB_CONNECT->getPassword(), $DB_CONNECT->getName());
if ($this->connection->connect_errno) {
echo "Failed to connect to MySQLI: " . $this->connection->connect_error;
}
}
示例2: __construct
public function __construct()
{
try {
$DB_CONNECT = new DB_CONNECT();
$this->databaseConnection = mysql_connect($DB_CONNECT->getHost(), $DB_CONNECT->getUsername(), $DB_CONNECT->getPassword()) or die("Unable to connect to MySQL");
$this->selectedDatabase = mysql_select_db($DB_CONNECT->getDatabase(), $this->databaseConnection) or die("Could not select database");
} catch (Exception $error) {
echo 'Caught exception: ', $error->getMessage(), "\n";
}
}