$mysqlServer = "***";
$mysqlDb = "***";
$mysqlUser = "***";
$mysqlPass = "***";
$conn = mysqli_connect($mysqlServer, $mysqlUser, $mysqlPass) or die("failed to connect to db");
mysqli_select_db($conn, $mysqlDb) or die("failed to connect select db");
我有这个代码,它的工作没有任何问题。但是如果我尝试输入错误的 sql server 或测试它以执行错误。这将显示:
Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
failed to connect select db
如果连接 sql 服务器出现问题,我不希望显示警告。我只想显示我自己的错误。