【发布时间】:2014-03-30 20:58:51
【问题描述】:
我想在我的 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
));
有什么想法吗?
【问题讨论】:
标签: php namespaces symfony-1.4 autoload