【发布时间】:2020-03-02 17:10:58
【问题描述】:
我使用这个代码:
require_once __DIR__."/vendor/autoload.php";
use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Grant\PasswordGrant;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
$clientRepository = new ClientRepository();
但我得到错误:
致命错误:未捕获的错误:在中找不到类“ClientRepository” /home/a/public_html/app/oauth2.php:23 堆栈跟踪:#0 {main} 抛出 /home/a/public_html/app/oauth2.php 第 23 行
【问题讨论】:
-
你可能也应该
useClientRepository,或者代替ClientRepositoryInterface -
我添加了使用
League\OAuth2\Server\Repositories\ClientRepository;但不起作用 -
@Ogreucha 我读了那个回复,但对我不起作用
-
@user12330913 您必须创建自己的 ClientRepository 类,如该答案中所述。
标签: php oauth oauth-2.0 autoload