PHP怎么判断字符串里有没有乱码?9�2���5�

发布时间:2016-09-02 17:49:51编辑:丝画阁阅读(365)

用正则匹配除中文、数字、字母、符号之外的字符


黑魔法之json_encode( $text ) === 'null'



http://php.net/manual/en/function.iconv.php


If you append the string //IGNORE, characters that cannot be represented in the target charset are silently discarded.


PHP在连接数据库后都要执行SET NAMES UTF8,防止mysql某个字符集设置的不正确。

今天突然想测试一下,然后尝试把SET NAMES UTF8注释掉,把mysql端的

character_set_connection
character_set_results
character_set_server
character_set_client

统统global设置为utf8

然后的然后,发现插入中文字符又是乱码了,整个人都不好了。

本地的代码和数据库肯定是UTF8的


<meta http-equiv="Content-Type" content="text/html; charset=?" />

关键字