繁体   English   中英

在flickr API中显示错误

[英]show error in flickr api

我正在使用这个API

   <?php 
    require_once("phpFlickr.php");
    $f = new phpFlickr("$api_key");
    $api_key                 = "my api key";
    $api_secret              = "my api secret";
    $recent = $f->photos_getRecent();
    print_r($recent);

    foreach ($recent['photo'] as $photo) {
        $owner = $f->people_getInfo($photo['owner']);
        echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>";
        echo $photo['title'];
        echo "</a> Owner: ";
        echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>";
        echo $owner['username'];
        echo "</a><br>";
    }
    ?>

但它给出了错误

Warning: Invalid argument supplied for foreach() in /home/content/27/9937227/html/project/ww/example.php on line 23

可能是什么问题?

初始化phpFlickr对象之前,请先放置API密钥,因为它依赖于此API密钥。

<?php 
require_once("phpFlickr.php");
$api_key  = "my api key";
$api_secret = "my api secret";
$f = new phpFlickr($api_key);
/* ... rest of the code ... */

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM