che*_*505 1 php mysqli namespaces
我正在尝试扩展mysqli到我的命名空间之外。每当我运行它时,它都无法mysqli在命名空间内找到。如何访问mysqli命名空间之外的内容?
这是我的代码:
<?php
namespace xBell\Database;
class Database extends mysqli {
public function __construct() {
$hostname = \eBot\Config\Config::getInstance()->getMySQLIP();
$username = \eBot\Config\Config::getInstance()->getMySQLUser();
$password = \eBot\Config\Config::getInstance()->getMySQLPassword();
$database = \eBot\Config\Config::getInstance()->getMySQLIP();
parent::__construct($hostname, $username, $password, $database);
if(mysqli_connect_error()) {
\eBot\Printer\Printer::error("Unable to connect to the MySQL server! Error: " . mysqli_connect_error());
}
}
}
?>
Run Code Online (Sandbox Code Playgroud)
谢谢!