【发布时间】:2011-07-11 17:05:00
【问题描述】:
$feedURL = 'http://########.tumblr.com/api/read/';
$xml = simplexml_load_file($feedURL);
foreach($xml->posts->post as $post){
$posts = (string) $post->{'photo-caption'};
$img = (string) $post->{'photo-url'};
echo "<div style='width:518px;height:300px;'><div style='width:200px;height:200px;float:left;'>".'<img style="width:200px;height:200px;" src="' . $img . '" />'."</div><div style='width:300px;float:right;'>".$posts."</div></div><br>";
}
我已使用此代码显示所有可用的帖子,但我只想显示前五个帖子
【问题讨论】: