我想在我的symfony(1.4)项目中包含phpleague的oauth客户端(https://github.com/thephpleague/oauth2-client),但它在任何地方使用命名空间,所以我查看了一个解决方法并提出了使用Symfony2 Universal自动加载器,以及我的projectConfiguration.class.php中的这段代码
public function namespacesClassLoader()
{
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'League' => __DIR__ . '/../lib/League',
));
$loader->register();
}
在setup()中调用该函数。当我尝试实例化像这样的提供者
时,这不起作用$provider = new League\OAuth2\Client\Provider\Google(array(
'clientId' => '',
'clientSecret' => '',
'redirectUri' => $redirect_url
));
有什么想法吗?
答案 0 :(得分:0)
所以这是很久以前修复的,但对于任何有兴趣的人我只需要改变这个
$loader->registerNamespaces(array(
'League' => __DIR__ . '/../lib/League',
));
到这个
$loader->registerNamespaces(array(
'League' => __DIR__ . '/../lib',
));