我这样做并且它有效。
<?php
function load_file($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = simplexml_load_string(curl_exec($ch));
return $xml;
}
$feedurl = 'http://www.astrology.com/horoscopes/daily-extended.rss';
$rss = load_file($feedurl);
$items = array();
$count = 0;
foreach ($rss->channel->item->description as $i => $description)
{
$items[$count++] = $description;
}
echo $items[0];
?>
当我echo $items[1];
没有显示下一个时。不知道我做错了什么。