简体   繁体   English

Symfony \\\\ Component \\\\ Debug \\\\ Exception \\\\ FatalErrorException“,” message“:”找不到类'Authy_Api'

[英]Symfony\\Component\\Debug\\Exception\\FatalErrorException“,”message“:”Class 'Authy_Api' not found

{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Authy_Api' not found","file":"\/home\/vagrant\/Code\/curve\/app\/controllers\/UsersController.php","line":9}}

I added "authy-php": "2.*" to my composer.json file under "laravel/framework": "4.2.*" 我在"laravel/framework": "4.2.*"下的composer.json文件中添加了"authy-php": "2.*" "laravel/framework": "4.2.*"

In my controller I instantiate it like so: 在我的控制器中,我将其实例化为:

private $authy;

public function __construct()
{
    $this->authy = new Authy_Api(Config::get('authy.authy'));
}

I ran composer update and composer dump-autoload and neither of the two solved my problem. 我运行了composer updatecomposer dump-autoload ,两者都没有解决我的问题。

I also tried to do the top 10 google search results none of which fixed the problem. 我也尝试做十大谷歌搜索结果,没有一个解决了这个问题。

Why is it not recognizing the class from the package? 为什么无法从包装中识别出班级?

You should use in your controller: 您应该在控制器中使用:

$this->authy = new \Authy\Authy_Api(Config::get('authy.authy'));

and not 并不是

$this->authy = new Authy_Api(Config::get('authy.authy'));

because Authy_Api is defined in Authy namespace 因为Authy_Api是在Authy名称空间中定义的

From the github readme. 来自github自述文件。 For composer require: 对于作曲家,要求:

"authy/php": "2.*"

and for using the class 和使用班级

$authy_api = new Authy\AuthyApi('#your_api_key');

Reference 参考

Authy/Php Readme Authy / Php自述文件

暂无
暂无

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

相关问题 找不到类“角色” [Symfony \\ Component \\ Debug \\ Exception \\ FatalErrorException] - Class 'Role" not found [Symfony\Component\Debug\Exception\FatalErrorException] 在 Laravel 项目中找不到 Symfony\\Component\\Debug\\Exception\\FatalErrorException Trait - Symfony\Component\Debug\Exception\FatalErrorException Trait not found in Laravel project FatalErrorException:错误:未找到类'Symfony \\ Component \\ Form \\ Exception \\ FormException' - FatalErrorException: Error: Class 'Symfony\Component\Form\Exception\FormException' not found Symfony\Component\Debug\Exception\FatalErrorException laravel 错误 - Symfony\Component\Debug\Exception\FatalErrorException laravel Error 如何在 PHP (Laravel) 中调试“Symfony\\Component\\Debug\\Exception\\FatalErrorException”错误? - How to debug "Symfony\Component\Debug\Exception\FatalErrorException" errors in PHP (Laravel)? Symfony \ Component \ Debug \ Exception \ FatalThrowableError类'Buno \ Readr \ ReadrServiceProvider'未找到 - Symfony\Component\Debug\Exception\FatalThrowableError Class 'Buno\Readr\ReadrServiceProvider' not found 找不到Laravel Forge返回[Symfony \\ Component \\ Debug \\ Exception \\ FatalThrowableError]类 - Laravel Forge returning [Symfony\Component\Debug\Exception\FatalThrowableError] class not found 找不到Symfony \\ Component \\ Debug \\ Exception \\ FatalThrowableError类'\\ App \\ Admin' - Symfony\Component\Debug\Exception\FatalThrowableError Class '\App\Admin' not found Symfony \\ Component \\ Debug \\ Exception \\ FatalErrorException调用未定义的方法Illuminate \\ Database \\ MySqlConnection :: setReconnector() - Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to undefined method Illuminate\Database\MySqlConnection::setReconnector() FatalErrorException:错误:在symfony2上找不到类'PDO' - FatalErrorException: Error: Class 'PDO' not found on symfony2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM