PHP致命错误:未找到类mysqli

PHP致命错误:未找到类mysqli,php,mysql,mysqli,Php,Mysql,Mysqli,当我尝试使用mysqli连接时,我得到以下错误 致命错误:找不到类panda\mysqli,该行在连接时显示“new mysqli” protected $db = null; public function __construct() { $this->connect(); } public function connect() { global $config; //it errors below here on the "new mysqli"

当我尝试使用mysqli连接时,我得到以下错误

致命错误:找不到类panda\mysqli,该行在连接时显示“new mysqli”

protected $db = null;

public function __construct()
{
    $this->connect();
}

public function connect()
{
    global $config;

    //it errors below here on the "new mysqli"
    $this->db = new mysqli($config['mysqli.host'], $config['mysqli.user'], $config['mysqli.pass'], $config['mysqli.name']);

    if ($this->db->connect_errno) 
    {
        echo 'Failed to connect to MySQLi: (';
        echo $db->connect_errno; 
        echo ') ';
        echo $db->connect_error;
        exit();
    }

    $db->set_charset("utf8");
}

您正在使用名称空间,默认情况下,PHP正在尝试从
panda
名称空间解析
mysqli
相对。一般规则是在核心PHP类驻留在“

相关文件”中时,在它们前面加上一个
\
:这在PHP5.3.0(大约2009年6月)中起作用。是的,一些网络酒店仍然使用早于5.3的PHP版本。