如何纠正致命错误:未捕获的错误:未找到类'mysqli'?

时间:2020-07-06 19:53:49

标签: php

我今天将文件上传到实时托管服务器上,并在加载网址后显示此错误。

致命错误:未捕获错误:在/home3/maalu/public_html/php_action/db_connect.php:9中找不到类'mysqli':堆栈跟踪:#0 /home3/maalu/public_html/index.php(2):include_once ()在第9行的/home3/maalu/public_html/php_action/db_connect.php中抛出#1 {main}

下面是我的数据库连接。

<?php   

$localhost = "localhost";
$username = "maalu";
$password = "********";
$dbname = "stock";

// db connection
$connect = new mysqli($localhost, $username, $password, $dbname);

// check connection
if (mysqli_connect_errno($connect)) 
{ // creation of the connection object has some other error
    die("Connect failed: ".mysqli_connect_errno()." : ". mysqli_connect_error());
}

?>

请帮助。

0 个答案:

没有答案