Home  >  Article  >  Backend Development  >  PHP中iconv函数编码转换乱码解决技巧

PHP中iconv函数编码转换乱码解决技巧

WBOY
WBOYOriginal
2016-06-20 13:04:341227browse

PHP中iconv函数编码转换乱码解决技巧

iconv函数让PHP读取UTF-8内容更方便了,不过此函数有一个BUG,就是会把汉字截断;

解决办法有一个,就是在在iconv函数第二个参数后加上//IGNORE

该参数的意义是是忽略转换时的错误;

例子如下:

$Result=iconv('UTF-8','GB2312//IGNORE',$Result); //编码转换


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