Home  >  Article  >  Backend Development  >  各大神帮帮忙,如何解决这个乱码有关问题

各大神帮帮忙,如何解决这个乱码有关问题

WBOY
WBOYOriginal
2016-06-13 12:10:21806browse

各大神帮帮忙,怎么解决这个乱码问题
这是前面部分
header("Content-Type:text/html;charset=utf-8");
?>






username:

password:


这是模拟服务器部分

header("Content-Type:text/html;charset=utf-8");

$mysqli=new mysqli("localhost","root","123456","web");

$result=$mysqli->query("select * from user where user='{$_POST["username"]}'");

if($result->num_rows > 0){
echo "用户{$_POST["username"]}已经存在,不能使用";
}else{
echo "用户{$_POST["username"]}不存在,可以使用";
}

在浏览器出现中文乱码,怎么解决呀,,,,,谢谢各位大神帮帮忙!!!!


------解决思路----------------------
你的服务端文件不是utf-8编码。改成utf-8编码应该就可以了。
------解决思路----------------------
看看你的PHP脚本文件编码格式必须是utf8才行呢
------解决思路----------------------
用编辑器保存为utf-8 无BOM头格式。
------解决思路----------------------
应该是bom头导致的
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn