簡體   English   中英

致命錯誤:在第15行的/home/wubb/public_html/facebook/fbml.php中調用未定義的方法Facebook :: require_frame()

[英]Fatal error: Call to undefined method Facebook::require_frame() in /home/wubb/public_html/facebook/fbml.php on line 15

我正在嘗試在我的網站中整合Facebook的好友邀請。 我正在使用php。 我包括了代碼:


<?PHP
// Get these from http://developers.facebook.com
$api_key = 'xxx';
$secret  = 'xxx';
// Names and links
$app_name = "Application name";
$app_url = "app-url"; // Assumes application is at http://apps.facebook.com/app-url/
$invite_href = "invite.php"; // Rename this as needed
require_once 'facebook.php';
$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$user = $facebook->require_login();
if(isset($_POST["ids"])) {
    echo "<center>Thank you for inviting ".sizeof($_POST["ids"])." of your friends on <b><a href=\"http://apps.facebook.com/".$app_url."/\">".$app_name."</a></b>.<br><br>\n";
    echo "<h2><a href=\"http://apps.facebook.com/".$app_url."/\">Click here to return to ".$app_name."</a>.</h2></center>";
} else {
    // Retrieve array of friends who've already authorized the app.
    $fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user.') AND is_app_user = 1';
    $_friends = $facebook->api_client->fql_query($fql);
    // Extract the user ID's returned in the FQL request into a new array.
    $friends = array();
    if (is_array($_friends) && count($_friends)) {
        foreach ($_friends as $friend) {
            $friends[] = $friend['uid'];
        }
    }
    // Convert the array of friends into a comma-delimeted string.
    $friends = implode(',', $friends);
    // Prepare the invitation text that all invited users will receive.
    $content =
        "<fb:name uid=\"".$user."\" firstnameonly=\"true\" shownetwork=\"false\"/> has started using <a href=\"http://apps.facebook.com/".$app_url."/\">".$app_name."</a> and thought it's so cool even you should try it out!\n".
        "<fb:req-choice url=\"".$facebook->get_add_url()."\" label=\"Put ".$app_name." on your profile\"/>";
?>
<fb:request-form
    action="<? echo $invite_href; ?>"
    method="post"
    type="<? echo $app_name; ?>"
    content="<? echo htmlentities($content,ENT_COMPAT,'UTF-8'); ?>">
    <fb:multi-friend-selector
        actiontext="Here are your friends who don't have <? echo $app_name; ?> yet. Invite whoever you want -it's free!"
        exclude_ids="<? echo $friends; ?>" />
</fb:request-form>
<?PHP
}
?>
[[Image:multi-friend-selector.png]]

在這里,我包含了從github下載的facebook.php文件。我嘗試了許多版本的phpSDK,但仍然出現以下錯誤

致命錯誤:調用未定義的方法Facebook :: require_frame()

誰能建議哪個版本包含此功能或如何解決此問題。 我已經浪費了很多時間來解決這個問題。 因此,請盡快做出回應。

Trikode,

確保您使用的是最新版本的php sdk: https : //github.com/facebook/facebook-php-sdk 這里有一個非常容易遵循的指南,可以幫助您入門: https : //developers.facebook.com/docs/reference/php/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM