如何在Laravel 5的控制器中加载Facebook类或任何其他非Laravel包。我已经安装了facebook SDK -在我的composer.json:
"facebook/php-sdk-v4" : "~5.0"
In my controller:
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppHttpRequests;
use AppHttpControllersController;
use Facebook;
class MyController extends Controller
{
public function index()
{
// this fails
$fb = new Facebook();
}
}
生成错误:
Class 'AppHttpControllersFacebook' not found
如何加载Facebook包或任何其他自定义包在我的控制器?
好的,我解决了这个问题,这里是实例化Facebook类的正确方法:
错:$fb = new Facebook(....)
正确的:
$fb = new FacebookFacebook(....)