5
RSS提要例如,在PHP的方式来解析RSS源可能是:的Symfony如何解析上的树枝
<?php
$rss = simplexml_load_file('http://blog.wordpress_site.com/feed/');
{{ rss }}
foreach ($rss->channel->item as $item) {
echo $item->title;
echo $item->link;
echo $item->description;
echo $item->guid;
}
?>
我怎么能有这样的细枝?
UPDATE:感谢我的答复。现在,通过项目得到这一点,但不是像图像,类别或职位的文本的某些字段:
SimpleXMLElement {#955 ▼
+"title": "Website. Description of the website"
+"link": "http://blog.website.com/liktothepost"
+"pubDate": "Fri, 17 Feb 2017 07:56:43 +0000"
+"category": SimpleXMLElement {#1131}
+"guid": "http://blog.website.com/?p=400"
+"description": SimpleXMLElement {#953}
}
的感谢!根据你的回复,我终于用你的代码在一个扩展中做了一个Twig函数,谢谢!我已经更新了与另一个问题,请你能帮助我吗? – jmunozco
你能为此发布新问题吗?这似乎是另一个问题......我会尽可能地看看它。另外,我没有在该转储中看到“image”或“text”,因此请确保提供该问题的详细信息。 –