我正在制作一个小型 RSS 阅读器,我希望它能够解析网站并列出提要。但是<ul>
and<li>
标签没有被渲染。有什么建议么?
<?php
header("Content-Type: text/plain; charset=utf-8");
function jobs() {
$output = array();
$feed_url = 'http://www.jobs.ge/rss/jobs/';
$feed = simplexml_load_file($feed_url);
for($j=0; $j<10; $j++){
$title = $feed ->channel->item[$j]->title;
$link = $feed ->channel->item[$j]->link;
$desc= $feed ->channel->item[$j]->description;
$date = $feed ->channel->item[$j]->pubDate;
$output[] = array (
'title' =>$title,
'link' =>$link,
'description'=> $desc,
'date'=> $date,
);
}
return $output;
}
$feed = jobs();
?>
<ul>
<?php
foreach ($feed as $item) {
echo '<li>', $item['title'],'</li>';
}
?>
</ul>