abstract:<?php//加上@符 报错信息不回显示$db = @mysqli_connect('127.0.0.1','root','root','phpcn','3306','');//不加的话会显示报错的行数//$db = mysqli_connect('127.0.0.1','
<?php
//加上@符 报错信息不回显示
$db = @mysqli_connect('127.0.0.1','root','root','phpcn','3306','');
//不加的话会显示报错的行数
//$db = mysqli_connect('127.0.0.1','root','root1','phpcn','3306','');
//mysqli_connect_error() 输出错误原因 不显示第几行
if(!$db){
exit('数据库连接失败'.mysqli_connect_error());
}
mysqli_close($db);
print_r($db);
Correcting teacher:天蓬老师Correction time:2018-11-09 13:25:08
Teacher's summary:数据库的连接,建议将参数放在变量或常量中,这样更好些