$host = '127.0.0.1'; $user = ''; $pass = ''; $db = ''; $conn = mysqli_connect($host, $user, $pass, $db); if (!$conn) { die("连接失败: " . mysqli_connect_error()); } echo "数据库连接成功!";
原创文章,转载请注明:转载自Web开发笔记 | 使用PHP编写脚本测试数据库连接是否正常
本文链接地址:https://www.magentonotes.com/php-script-test-mysql-connect.html
Comments on this entry are closed.