Home > php教程 > php手册 > body text

php5的simplexml解析错误

WBOY
Release: 2016-06-13 10:59:32
Original
975 people have browsed it

  前阵子用simplexml来解析一个rss数据源,很轻松就获得了想要的结果.不想没几天就开始报错:

Warning: simplexml_load_file() [function.simplexml-load-file]: input conversion failed due to input error, bytes 0xAD 0xB5 0x3C 0x2F

  刚开始猜想是php5的一个bug,但是搜索发现,有可能是rss源内混杂了其它编码的字符,导致simplexml解析错误.

  也就是说,如果rss的声明是这样子:

PLAIN TEXTXML:

那么rss内容一定要是gb2312.

解决办法

用iconv转换编码

修改encoding为正确的编码


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!