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

WBOY
Release: 2016-06-20 13:04:34
Original
1233 people have browsed it

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

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

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

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

例子如下:

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


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