从 index.php 页面呈现 RSS 提要并没有那么糟糕,我已经看到了很多这样的例子。但是我在上课时遇到问题。这就是我所拥有的,我确信我有很多错误...... PHP不是我的强项,所以如果你能让我知道我哪里出错了,我会感激它......
<?php
class RssDisplay {
protected $fromrss;
protected $allitemscollected_feed;
public function __construct($urllink, $total_items){
$this->fromrss = $urllink;
$this->allitemscollected_feed = $total_items;
}
public function getItems($allitemscollected_feed){
$feed = simplexml_load_file($this->fromrss, $this->allitemscollected_feed);
return $feed;
$collected_items[] =$feed;
$this->set('collected_items', $collected_items);
}
foreach('allitemscollected' as $feed){
$items->title;
$items->pubDate;
$items->description;
}
}
从我的索引来看,这就是我正在做的事情:
$feed = new RssDisplay('http://feeds.feedburner.com/insidethehall?format=xml');