I am trying to implement Facebook
SDK
for PHP
with Yii 2
. I am totally new to this and doing this in my config
file:
'facebook' => [
'class' => 'frontend/components/Facebook/Facebook'
]
The 'Facebook' folder is placed inside components folder, inside frontend. I am trying to include it like this:
use Facebook/Facebook;
But it doesn't work. How can I do it right? Any help regarding this?
In Facebook
class you should have namespace:
namespace frontend\components\facebook;
And then use this like:
use frontend\components\Facebook\Facebook;
If u defined it in components in config
just use it like:
\Yii::$app->facebook
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.