0

我正在使用此数组在照片中标记朋友,但没有人被标记,如果我错了,请帮助我。

$tags = array( 
    "tag_uid" => $id,
    "tag_text" => $name,
    "x" => 20,
    "y" => 20
     );
 $facebook->api('/' . $new . '/tags?','post',  array( $tags ));
4

1 回答 1

1

这是因为您没有做正确的标签数组。尝试以下代码:

// Set tags limit
    $f1 = $facebook->api('me/friends?limit=10');

    // Get access token
    $access_token = $facebook->getAccessToken();

    // First post photo and then tag id
    $post_photo = $facebook->api('/me/photos', 'POST', array(
                                     'source' => '@' . $photo,
                                     'message' => $message
                                     )
                                  );
    // Creating Tags arrays for Tagging in the photo
    foreach($f1['data'] as $fbu){
    $tagx = array('tag_uid' => $fbu['id'],'x' => 30,'y' => 30 );
    $ftags[] = $tagx;
    }

    // Tags generated now giving variable
    $tagargs = array (
        'tags' => json_encode($ftags),
        'access_token' => $access_token,
    );

    // Posting the tags in photo
    $result = $facebook->api('/' . $post_photo['id'] . '/tags', 'post', $tagargs);
于 2014-01-14T08:34:09.223 回答