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

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

WBOY
Release: 2016-06-13 11:19:15
Original
785 people have browsed it

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

请问问题是出现在哪里?


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

同样是乱码。

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