这是发生的错误:
Warning: simplexml_load_file() [function.simplexml-load-file]: dump.xml:43: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xC7 0xD2 0xB7 0xCE in /usr/local/www/_test.php on line 3
Warning: simplexml_load_file() [function.simplexml-load-file]: <item id="740" name="'ÇҡÎŔŠ ČŁšÚ¸Ó¸Ž'" in /usr/local/www/_test.php on line 3
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /usr/local/www/_test.php on line 3
问题出在哪里?
我想问题是因为这个字符串:ÇҡÎŔŠ ČŁšÚ¸Ó¸Ž
,但没有任何方法强制加载它吗?
$str = utf8_encode(file_get_contents('http://yourwebsite.com/your.xml'));
$xml = simplexml_load_string($str);
所有数据都必须在UTF8中。您需要将您的字符转换为UTF8
http://php.net/manual/en/function.utf8-encode.php