致命错误:在第 7 行的 /home/a2424901/public_html/index.php 中调用未定义的函数


Fatal error: Call to undefined function facebook() in /home/a2424901/public_html/index.php on line 7 . Please help in making this code correct

<?php
session_start();
require_once 'facebook.php';
$app_id = "418907881455014";
$app_secret = "36389d2c4caaf6de86982cb87686a494";
$redirect_uri = 'http://gooogle12.comuf.com';
$facebook = Facebook(array(
        'appId' => $app_id,
        'secret' => $app_secret,
        'cookie' => true
));
$user = $facebook->getUser();
$user_profile = $facebook->api('/me');
$coded = $_REQUEST['code'];
$access_token = $facebook->getAccessToken();
$name = "".$user_profile['name']."";
$fbid = "".$user_profile['id']."";
function RandomLine($filename) {
    $lines = file($filename) ;
    return $lines[array_rand($lines)] ;
}
$reason = RandomLine("reason.txt");  
$canvas = imagecreatefromjpeg ("test3/bg.jpg");                                   // background image file
$black = imagecolorallocate( $canvas, 0, 0, 0 );                         // The second colour - to be used for the text
$font = "arial.ttf";                                                         // Path to the font you are going to use
$fontsize = 20;                                                             // font size
$birthday = "".$user_profile['birthday']."";
$death = "- ".date('d/m/Y', strtotime( '+'.rand(0, 10000).' days'))."";
imagettftext( $canvas, 22, -1, 110, 120, $black, $font, $name );            // name
imagettftext( $canvas, 22, -1, 110, 170, $black, $font, $birthday );        // birthday
imagettftext( $canvas, 22, -1, 255, 172, $black, $font, $death );           // death
imagettftext( $canvas, 20, -1, 110, 220, $black, $font, $reason );           // reason
imagejpeg( $canvas, "img/".$fbid.".jpg", 50 );
$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
        'message'=> 'How will you die?',
        'name'=> 'How will you die?'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//Get album ID of the album you've just created
$album_uid = $create_album['id'];
//Upload a photo to album of ID...
$file='img/'.$fbid.'.jpg'; //Example image file
$photo_details = array( 'message'=> 'Find...51', 'image' => '@'.realpath($file));
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
$upphoto = $upload_photo['id'];

ImageDestroy( $canvas );
header("Location: http://facebook.com".$fbid."&photoid=".$upphoto."")
?>

这是我正在使用的这个脸书.php文件——http://pastebin.com/GF69gW2F。但是每次我打开我的 facebook 应用程序时,它都会给我 fatat 错误调用第 7 行/home/a2424901/public_html/index.php 中的未定义函数 facebook()。我不是程序员,所以我可以知道这段代码到底出了什么问题。我正在尝试使用此代码制作Facebook应用程序。帮帮我。

在尝试实例化Facebook对象之前,您缺少 new 关键字,尽管您在上一个问题中似乎确实有它。

这一行:

$facebook = Facebook(array(

应该是

$facebook = new Facebook(array(

7 行:像这样:

$facebook = new Facebook(array(
    'appId' => $app_id,
    'secret' => $app_secret,
    'cookie' => true
));