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

PHP UTF-8乱码问题

WBOY
WBOYOriginal
2016-06-23 14:28:491026browse

用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);

 

中应是UTF8而不是UTF-8

郁闷!!!!

 

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
Previous article:PHP 学习笔记 2011-06-29Next article:PHP 读取网页文件