vendredi 27 mars 2015

"use Facebook\whatever" seems to not work

I've tried to go through all the tutorials and answers remotely close to this with no such luck.


I'm able to get my code to work within the same file but I'm trying to work on splitting it out into a class (controller calls on collector). When moving code to the collector (which I'm including at the beginning of ), the PHP stops at "--->" line:



public function FacebookClientObject() {

$facebookId = "xxxxx";
$facebookAppSecret = "yyyyy";
--->FacebookSession::setDefaultApplication($facebookId, $facebookAppSecret);
echo "default set";
}


Assuming this is because the function doesn't have access to the static method, I've tried



use Facebook\FacebookSession;


at the beginning of the function. The collector fails to be included at the beginning of the controller when this is added. I've moved the autoloader around the two files (including to the beginning of FacebookClientObject()) and confirmed that it's being loaded via echo statements and it doesn't seem to impact this issue.


I've even included the file using



require_once(FULLPATH . 'libs/facebook-php-sdk-v4/src/Facebook/FacebookSession.php');


instead of use Facebook\FacebookSession;


I feel like this should be something very simple that I'm just overlooking.


Aucun commentaire:

Enregistrer un commentaire