我在使用 simplexml_load_string 处理非标准字符时遇到了困难。
我已经使用 file_get_contents 加载了报纸 xml 提要。如果我打印以筛选内容,我会得到其中一篇文章的标题:
<title>‘If Legault were running in Alberta, he’d be more popular’: How right-wing is the CAQ?</title>
如果我这样做:
$feed = @simplexml_load_string($xml);
并打印 $feed 的结果,标题已更改为:
[title] => �If Legault were running in Alberta, he�d be more popular�: How right-wing is the CAQ?
关于如何阻止这些字符像这样显示的任何建议?