Home  >  Article  >  Backend Development  >  关于读取数据编码有关问题

关于读取数据编码有关问题

WBOY
WBOYOriginal
2016-06-13 12:50:14770browse

关于读取数据编码问题
php文件和数据库均为utf8格式,读取数据库中数据出来居然是GB2312编码,可是数据表 字段均为utf8格式,只能在页面内选择编码为gb2312才能够正常显示。

请问问题是出现在哪里?


------解决方案--------------------
引用:
引用:mysql_query("set names utf8");  //查询时用utf8编码查询

同样是乱码。

set names utf8 只对其后的数据有效,并不会改变数据库中原有的数据
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