PHP连接数据库
<?php
$servername = "localhost";
$username = "root";
$password = "123456";
// 创建连接
$conn = new mysqli($servername, $username, $password);
// 检测连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
echo "连接成功";
?>
标签:class mysqli body -- sqli serve sql connect echo
PHP连接数据库
<?php
$servername = "localhost";
$username = "root";
$password = "123456";
// 创建连接
$conn = new mysqli($servername, $username, $password);
// 检测连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
echo "连接成功";
?>
标签:class mysqli body -- sqli serve sql connect echo
原文地址:https://www.cnblogs.com/bmzy/p/8290227.html