simplexml_load_file因'&'而失败在xml feed中

时间:2014-08-19 12:02:06

标签: php xml rss

错误:

Warning: simplexml_load_file(): feed.rss:2393: parser error : xmlParseEntityRef: no name in C:\xampp\htdocs\mklbet\index.php on line 16

Warning: simplexml_load_file(): <title>We have a winner & it is ME</title> in C:\xampp\htdocs\mklbet\index.php on line 16

我的问题是,当我使用simplexml_load_file($ url)时 - 在xml提要中有一个&#39;&amp;&#39;它会出错 - 我怎样才能让它发挥作用?

if (file_exists($url)) {
       $tips = simplexml_load_file($url);

    } else {
        exit('Failed to open stream');
    }

        foreach ($tips->channel->item as $entry) {

            $title=htmlentities($entry->title);
}
}

这就是我编写代码的方式,我从其他网站获取rss feed所以我无法编辑该字符

0 个答案:

没有答案