简体   繁体   English

致命错误:未捕获错误:未找到 Class 'ClientRepository'

[英]Fatal error: Uncaught Error: Class 'ClientRepository' not found

I use this code:我使用这段代码:

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();

But I get error:但我得到错误:

Fatal error: Uncaught Error: Class 'ClientRepository' not found in /home/a/public_html/app/oauth2.php:23 Stack trace: #0 {main} thrown in /home/a/public_html/app/oauth2.php on line 23 Fatal error: Uncaught Error: Class 'ClientRepository' not found in /home/a/public_html/app/oauth2.php:23 Stack trace: #0 {main} thrown in /home/a/public_html/app/oauth2.php on第 23 行

Maybe, you forgot namespace:也许,您忘记了命名空间:

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;

use NamespaceClass\ClientRepository; <-- edit

$clientRepository = new ClientRepository();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM