Home > Backend Development > PHP Tutorial > PHP UTF-8乱码问题

PHP UTF-8乱码问题

WBOY
Release: 2016-06-23 14:28:49
Original
990 people have browsed it

用PHP+MySql获取出来的数据用UTF-8编码是乱码。

原来是

1 //解决乱码问题:2 /*PHP通过设置character_set_client,告诉Mysql,PHP存进数据库的是什么编码方式。 3 PHP通过设置character_set_results,告诉Mysql,PHP需要取什么样编码的数据。 4 PHP通过设置character_set_connection,告诉Mysql,PHP查询中的文本,使用什么编码。 */5 @mysql_query("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary",$conn);
Copy after login

 

中应是UTF8而不是UTF-8

郁闷!!!!

 

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