“使用Facebook \无论什么”似乎不起作用

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.

At issue was how I was trying to use the namespaces.

1) I was putting use Facebook\yyyyyy; inside the function, and also just inside the class. This caused errors in both places. Such code belongs at the beginning of the file before class declaration.

2) When attempting to require_once the files instead, it didn't have the namespaces set, so the Facebook autoloader wasn't able to find the classes which also caused an error. This was even though I could verify the classes were declared with print_r(get_declared_classes());.

3) Of crucial importance was adding error_reporting(E_ALL); and ini_set('display_errors', 1); to the beginning of my code. While I could figure out which lines were causing the issues, I didn't know why before that.

Thanks halfer!