【发布时间】:2012-03-27 15:58:54
【问题描述】:
我想在我的网站中包含来自 tumblr 博客的最新帖子,这很好用。不过,我不知道如何从 API 中选择特定标签。
XML 具有以下结构:
<tumblr>
<posts>
<post>
<photo-url max-width="500">
image_500.jpg
</photo-url>
<photo-url max-width="250">
image_250.jpg
</photo-url>
</post>
</posts>
</tumblr>
现在如何在此处的第三行指定我想要 250 版本?
<?php
$xmlResult = file_get_contents($tumblr_url_aktuell);
$xml = simplexml_load_file($tumblr_url_aktuell);
$image = $xml->posts->post->{'photo-url'}
?>
谢谢!
【问题讨论】: