Php 如何使用facebook api获取您自己的facebook图像

Php 如何使用facebook api获取您自己的facebook图像,php,facebook,api,Php,Facebook,Api,我设置了所需的权限并获得了显示的路径ie me/photos: { "data": [ { "id": "78768", "from": { "name": "Dai beckham", "id": "135656456" }, "picture": "link here", "source": "link here", "height": 540, "widt

我设置了所需的权限并获得了显示的路径ie me/photos:

    {
  "data": [
    {
      "id": "78768",
      "from": {
        "name": "Dai beckham",
        "id": "135656456"
      },
      "picture": "link here",
      "source": "link here",
      "height": 540,
      "width": 720,
      "images": [
        {
          "height": 720,
          "width": 960,
          "source": "link here"
        }, 
然后我尝试回显图像路径,如
echo$user\u graph['data']['source']但是我得到一个错误

“注意:第12行:file-name.php中的未定义索引:source”


我不知道我哪里出错了。提前谢谢

您需要将响应转换为数组,然后才能这样访问它

目前它的格式。您可以使用本机函数为您转换它

$array = json_decode($response, true);

$source = $array['data']['source'];

只需从这个url获取


键入您的名字而不是我的ankit.varia(me)=(您的)

看起来像
json
,您是否先将其转换为数组
json_decode()
如果其中一个答案对您有帮助,请记住通过单击上下箭头下方的复选标记接受答案。
$array = json_decode($response, true);  //it will provide array
$source = $array['data']['source']; and access it now