【发布时间】:2014-05-09 18:44:48
【问题描述】:
OAuth 2.0 Server PHP 有一个小问题,我想在我的项目中使用它。这是我的项目的树视图:
/Model/ 包含管理API的所有类
/Lib/ 包含所有第三方库
对于“IO\Model”和库为“IO\Lib”的模型,根命名空间为“IO”。我遇到的问题来自命名空间,目前“IO\Lib\OAuth2\Storage\Pdo”类是众所周知的,但找不到接口。我以前在其他项目中从未遇到过这个问题。
OAuth 2.0 服务器 PHP 库到它自己的命名空间“OAuth2”。这是我的脚本 Auth.php:
namespace IO\Model;
use IO\Lib\OAuth2 as OAuth2;
class Auth {
public function __construct() {
$this->config = Config::getInstance();
$storage = new OAuth2\Storage\Pdo(
array(
'dsn' => 'mysql:dbname='.$this->config->sql_database.';host='.$this->config->sql_host,
'username' => $this->config->sql_user,
'password' => $this->config->sql_password
)
);
$server = new OAuth2\Server($storage);
}
}
我收到了这个错误:
致命错误:在第 19 行的 /Lib/OAuth2/Storage/Pdo.php 中找不到接口“OAuth2\Storage\AuthorizationCodeInterface”
【问题讨论】:
-
你没有使用 Composer 吗?
标签: php interface namespaces oauth-2.0