伙计们,我正在 Laravel 中编写一个包含游戏的 facebook 应用程序,我需要保存最终分数。问题是,我需要获取用户 ID(谁在玩)才能将获得的分数保存到数据库中。
我已经安装了 Laravel 网站上的 FacebookSDK 包,但是当我尝试定义它时,我得到以下信息:
应用控制器:
<?php
class App_Controller extends Base_Controller {
public $restful = true;
public function get_check()
{
// Define FbkSDK
$facebook = IoC::resolve('facebook-sdk');
// Get UserId
$uid = $facebook->getUser();
}
public function get_game()
{
// Imprimo la pantalla del juego
}
}
错误:
Unhandled Exception
Message:
Class facebook-sdk does not exist
Location:
/home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/ioc.php on line 155
Stack Trace:
#0 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/ioc.php(155): ReflectionClass->__construct('facebook-sdk')
#1 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/ioc.php(118): Laravel\IoC::build('facebook-sdk', Array)
#2 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/application/controllers/app.php(10): Laravel\IoC::resolve('facebook-sdk')
#3 [internal function]: App_Controller->get_check()
#4 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/routing/controller.php(325): call_user_func_array(Array, Array)
#5 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/routing/controller.php(285): Laravel\Routing\Controller->response('check', Array)
#6 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/routing/controller.php(165): Laravel\Routing\Controller->execute('check', Array)
#7 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/routing/route.php(153): Laravel\Routing\Controller::call('app@check', Array)
#8 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/routing/route.php(124): Laravel\Routing\Route->response()
#9 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/laravel/laravel.php(167): Laravel\Routing\Route->call()
#10 /home/pablo/htdocs/conamor/CUENTAS/AventuraCenter/pacman/public/index.php(34): require('/home/pablo/htd...')
#11 {main}
我无法让它工作。我已按照所有安装说明进行操作。
任何想法?
谢谢!