【发布时间】:2017-09-15 05:22:50
【问题描述】:
我正在尝试创建一个小型应用程序,它可以简单地读取 RSS 提要,然后在页面上布局信息。
我发现的所有说明都使这看起来很简单,但由于某种原因它不起作用。我有以下
include_once(ABSPATH.WPINC.'/rss.php');
$feed = file_get_contents('http://feeds.bbci.co.uk/sport/0/football/rss.xml?edition=int');
$items = simplexml_load_file($feed);
就是这样,然后在第三行中断并出现以下错误
Error: [2] simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "<?xml version="1.0" encoding="UTF-8"?> <?xm
The rest of the XML file is shown.
我已经在我的设置中打开了 allow_url_fopen 和 allow_url_include 但仍然没有。 我尝试了多个提要,但最终都得到相同的结果?
我要疯了
【问题讨论】:
-
simplexml_load_file()需要文件名!对已加载的数据使用simplexml_load_string() -
如此简单但又如此有效..谢谢
标签: php