All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
php5的simplexml解析错误_[PHP教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/2/10 6:46:09 Browse times: 301 Comment times: 0

php5的simplexml解析错误_[PHP教程]


Head photo

Go homepage
Upload pictures
Write articles

php5的simplexml解析错误_[PHP教程] 前阵子用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为正确的编码

来源:网络





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.