mysqli_connect_error 乱码
代码如下
header("Content-Type: text/html; charset=utf-8");<br />$db_host='127.0.0.1';<br />$db_host='192.168.0.22';<br />$db_user='root';<br />$db_pwd='';<br />$db_name='iq1';<br />@$mysqli=new mysqli($db_host,$db_user,$db_pwd,$db_name);<br /><br />if (mysqli_connect_errno()){<br /> $str='<fieldset><legend>数据库连接失败</legend>';<br /> $str.="<p>可能的原因有:数据库防火墙未关闭、数据库服务未启用</p>";<br /> $str.="<p>返回的错误信息是 %s</p>";<br /> $str.="</fieldset>";<br /> printf ($str,mysqli_connect_error());<br /> exit();<br />};<br />?>
header("Content-Type: text/html; charset=utf-8");
printf ($str, iconv('gbk', 'utf-8', mysqli_connect_error()));