Warning XMLReader::read() [xmlreader.read]: input conversion failed due to input error
admin | 技术教程 | 八月 27th, 2013 | No Comments »
最近遇到一个PHP通过URL解析远程XML的问题,无法正常解析,出现如下的warning:
Warning XMLReader::read() [xmlreader.read]: input conversion failed due to input error, bytes 0xE9 0x65 0x20 0x65
Warning XMLReader::read() [xmlreader.read]: input conversion failed due to input error, bytes 0xE9 0x65 0x20 0x65
Warning XMLReader::read() [xmlreader.read]: An Error Occured while reading
经查,确认是编码的问题,要注意设置正确的编码:
$xml = new XMLReader ();
$xml->open ( $url, $charset );
环境说明:
Linux,Nginx,PHP 3.2.17
发表评论
你必须 登录 才能发表评论.