PHP乱码的问题【注:不是连接数据库乱码】
环境:XP系统, PHP 5.3.4, Apache web server 2.2, mysql 5.5
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
try{
$mysqli = new mysqli("localhost","username","password","db1",3306); //当mysql服务没开启时...
if($mysqli->connect_errno){
//注:SqlException是直接继承Exception的自定义类。
// echo $mysqli->connect_error; //乱码的来源...
throw new SqlException($mysqli->connect_error,$mysqli->connect_errno);
}
}catch(SqlException $e){
echo $e->getMessage(); //乱码
}
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号