Flickr图片拉入PHP JSON
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flickr图片拉入PHP JSON相关的知识,希望对你有一定的参考价值。
<?php $flickrId = 'userId'; // Find your Flickr ID at http://idgettr.com $flickrrequest = 'http://api.flickr.com/services/feeds/photos_public.gne?id=' . $flickrId . '&format=json'; // Flickr JSON doesn't come in standard form, some str replace needed // parameter 'true' is necessary for output as PHP array $flickritem = $flickrvalue['items']; // echo the channel information echo "<h3><a href="" . $flickrvalue['link'] . "">" . $flickrvalue['title'] . "</a></h3> "; echo "<p>" . $flickrvalue['description'] . "</p> "; $photosToDisplay = 5; //change this to the number of photos you want to display for($p=0;$p<$photosToDisplay;$p++){ echo "<a href="" . $flickritem[$p]['link'] . ""><img src="" . $flickritem[$p]['media']['m'] . "" /></a> "; } echo "<p><a href="" . $flickrvalue['link'] . "">View all my photos</p> "; ?>
以上是关于Flickr图片拉入PHP JSON的主要内容,如果未能解决你的问题,请参考以下文章
使用 PHP、curl 解码从 Flickr API 返回的 json 字符串
图片轮播 data-slide-to="?"使用 WordPress PHP