In my Symfony2 application I sometimes have to use some external APIs, classes, etc. which do not follow the PSR-0 standard.

When I try to use them with the "use" and "new" statements, I get an error that the class was not found. How can I make Symfony load classes which include underscores, for example Some_Class ?

没有正确的解决方案

其他提示

Is class A_B making use of the namespace? If so then you should be able to call it with is FQN EX:

use Acme\CoreBundle\Test\A_B;

Otherwise you need to use a require statement to load the file and that will load the class to the global namespace.

require_once 'Acme/CoreBundle/Test/A_B.php';

Im pretty sure thats how it works. Dont shoot me if im wrong.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top