为什么php设定php mysql_query(set names utf-8)后,中文还是乱码解决方案

WBOY
Release: 2016-06-13 13:30:22
Original
806 people have browsed it

为什么php设定php mysql_query(set names utf-8)后,中文还是乱码
如题 但是如果是gb2312就可以正常显示中文

------解决方案--------------------
应该是要保持编码一致的
网页中

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

------解决方案--------------------
用mysql4.0.27以前的版本.没有数据校对的话,就不会出现UTF-8的乱码问题,这是最直接的解决方法,其他方法的话.很麻烦,如果你网页文件本身是UTF-8格式的.那么,够你折腾的了.详情可参考http://topic.csdn.net/u/20090104/22/69c003fc-7e74-459a-a9f0-f22e43427e09.html这个.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template