mysql连接代码:
$servername = "localhost";
$username = "root";
$password = "root";
// 创建连接
echo "
";
echo "创建连接";
$conn = new mysqli($servername, $username, $password);
// 检测连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
echo "
";
echo "mysql连接成功";
?>
解决办法:
打开 extension_dir = "ext",即去掉分号;
打开 ,即去掉分号;
extension=php_mysql.dll
extension=php_mysqli.dll
重新执行,则错误消失。
注意:读不到有可能是路径问题。
解决 Fatal Error: Class 'mysqli' not found in...
原文:https://www.cnblogs.com/guanghuiqq/p/13266875.html