1

照片中标记朋友的多个 uid 不起作用。下面的代码仅适用于单个用户..我将数组中的三个 uid 传递给 foreach 后,我将它们传递给了 facebook graph api..如何使用 graph api ( $argstag) 在 facebook 中标记这 3 个 uid。任何人都可以帮助我......任何帮助都是appericiated..在此先感谢

$friends_tag_array[]=array('uid'=>'1472898480','x'=>'40','y'=>'40');

                      $friends_tag_array[]=array('uid'=>'100002109469765','x'=>'40','y'=>'40');

                      $friends_tag_array[]=array('uid'=>'561260191','x'=>'40','y'=>'40');

                      //echo '<pre>'; print_r($jsonfrnd); echo '</pre>'; die();
                      for($i=0;$i<count($friends_tag_array);$i++)
                      { 
                      foreach($friends_tag_array as $value)
                      { 
                      //print_r($value); die();

                      $friend = $value['uid'];  
                      //$frndId = $friends_tag_array[$i]['uid'];

                      $argstag = array('to'=>$friend);

                      $argstag['x'] = '40';

                      $argstag['y'] = '40';

                      }
                      } 

                     try 
                        {
                            $res = $facebook->api('/'.$json->id.'/tags', 'POST', $argstag);
                        }   catch (FacebookApiException $e) {

                            Mage::getSingleton('core/session')->addError($post_process_view->render(POST_PROCESS_TEMPLATES,'post_process-error.phtml'));

                       }
4

1 回答 1

2

下面的代码在多个标记时对我有用。希望它也可以帮助您调试问题

$friends_id = array('1472898480','100002109469765','561260191')
 $tags = array();
         foreach ($friends_id as $id)
         {
            $tag = array();
            $tag['tag_uid'] = $id;
            $tag['x'] = rand() % 100;
            $tag['y'] = rand() % 100;
            $tags[] = $tag;
         }
          $argstag = array(
            'tags' => $tags
          );

          $facebook->api("$photoId/tags","POST", $argstag);
于 2013-02-28T12:20:38.793 回答