您请求的某些别名不存在:{$ a_data-> id} [英] Some of the aliases you requested do not exist: {$a_data->id}

查看:167
本文介绍了您请求的某些别名不存在:{$ a_data-> id}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发Facebook应用程序时,出现以下错误,我无法更正:
您请求的某些别名不存在:{$ a_data-> id}

While I am developing a facebook application, the following error is coming which I am unable to correct: Some of the aliases you requested do not exist: {$a_data->id}

这是我的代码:

$request = new FacebookRequest($session, 'GET', '/me/albums?access_token='.$accessToken.'&limit=500');
         $response = $request->execute();
         $getUserAlbums = $response->getGraphObject();

         $userAlbums = $getUserAlbums->asArray();

         # logic for finding most liked user album
         foreach($userAlbums['data'] as $a_data){
            var_dump($a_data);
            $request = new FacebookRequest($session, 'GET', '/{$a_data->id}/likes?access_token='.$accessToken.'&limit=500');
            $response = $request->execute();
            $getAlbumLikes = $response->getGraphObject();

            $a_likes = $getAlbumLikes->asArray();
                foreach($a_likes['data'] as $a_likes1){
                    $a_like_array[] = $a_likes1->name;
                    $request = new FacebookRequest($session, 'GET', '{/$a_likes1->id}?access_token='.$accessToken.'&limit=500');
                    $response = $request->execute();
                    $getUserLikes = $response->getGraphObject();
                    $demouser_profile1 = $getUserAlbums->asArray();

                    if($demouser_profile1->gender == "male")
                        $mtalbum++;
                    else
                        $ftalbum++;
                }

                $a_no_of_likes = count($a_like_array);
                echo "<br>".$a_no_of_likes;

                if($highest_alikes < $a_no_of_likes){
                    $highest_alikes = $a_no_of_likes;
                    $req_album = $a_data;
                    $album_like_array = $a_like_array;
                    $malbum = $mtalbum;
                    $falbum = $ftalbum;
                }
                $a_like_array = array();    
                $mtalbum = $ftalbum = 0;
             }

这里是我在php中使用var_dump进行调试时得到的json。

and here is the json which I am getting when debugging using var_dump in php.

object(stdClass)#14 (11){  
   [  
      "id"
   ]   => string(15) "340014122769940"   [  
      "from"
   ]   => object(stdClass)#15 (2)   {  
      [  
         "id"
      ]      => string(15) "100002840667886"      [  
         "name"
      ]      => string(14) "Himanshu Gupta"
   }   [  
      "name"
   ]   => string(12) "Cover Photos"   [  
      "link"
   ]   => string(84) "https://www.facebook.com/album.php?fbid=340014122769940&id=100002840667886&aid=66194"   [ 
      "cover_photo"
   ]   => string(15) "340014129436606"   [  
      "privacy"
   ]   => string(8) "everyone"   [  
      "count"
   ]   => int(2)   [  
      "type"
   ]   => string(5) "cover"   [  
      "created_time"
   ]   => string(24) "2013-02-17T09:20:54+0000   " ["   updated_time"
]=> string(24) "2013-11-03T06:40:57+0000" ["can_upload"
]=> bool(false)
}

如何更正?

推荐答案

似乎你真的发送Facebook {$ a_data-> id} 的id,你实际上是要求 - 修复你的代码发送ID而不是该字符串

It seems like you're literally sending Facebook {$a_data->id} instead of the id you actually meant to ask for - fix your code to send the ID instead of that string

如果 {$ ....} 被解释为一个转义序列,修复这个可以像将单引号更改为双引号一样简单

If {$....} is interpreted as an escape sequence, fixing this could be as easy as changing the single quotes to double quotes

这篇关于您请求的某些别名不存在:{$ a_data-&gt; id}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆