douci1918 2013-11-07 09:06
浏览 52
已采纳

在Symfony 2中包含一个php类 - 旧方法

I need a fast way to test a code, please I know is not the best practice, but is there a way to load a class on a symfony controller without having to add namespaces, proxy class and autoloader stuff?

I tried:

public function singlepagestatsAction($id, $pid, $group) { 
    include '/var/www/web/welcomestuff/scripts/ga/gapi.class.php';
            $ga = new gapi('email','password');

Inside my controller, but when i execute it; Fatal error: Class 'Done\PunctisBundle\Controller\gapi' not found in /var/www/src/Done/PunctisBundle/Controller/BrandController.php on line 630

  • 写回答

1条回答 默认 最新

  • drwo32555 2013-11-07 09:09
    关注

    You should add \ before class name

    $ga = new \gapi('email','password');

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?