我正在製作一個小型的RSS閱讀器,我希望它解析一個網站並製作一個列表。但<ul>
和<li>
標記未呈現。有什麼建議麼?爲什麼我的列表不在PHP中呈現?
<?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>
你說這行不通。怎麼了? – petschekr 2012-04-14 17:29:43
它無法正確呈現。就像這樣:
不去管這些符號: 「შიდააუდიტორი」 他們是我的語言:d – gtboy 2012-04-14 17:32:21