带有 PHP 的 Google 身份验证器不起作用

问题描述

我正在尝试使用项目 https://github.com/sonata-project/GoogleAuthenticator 我首先安装了该项目: composer require sonata-project/google-authenticator 。 在此之后,当我想查看操作时收到错误

PHP 致命错误:在第 19 行的 /home/######/vendor/sonata-project/google-authenticator/src/GoogleAuthenticator.php 中找不到接口“Sonata\GoogleAuthenticator\GoogleAuthenticatorInterface”

我是不是忘记了什么?

任何帮助将不胜感激!

解决方法

我想你已经解决了这个问题,或者以某种方式绕过了它。但我的答案正在改变

include_once __DIR__.'/src/FixedBitNotation.php';
include_once __DIR__.'/src/GoogleAuthenticator.php';
include_once __DIR__.'/src/GoogleQrUrl.php';
include_once __DIR__.'/src/FixedBitNotation.php';
include_once __DIR__.'/src/GoogleAuthenticatorInterface.php';
include_once __DIR__.'/src/GoogleAuthenticator.php';
include_once __DIR__.'/src/GoogleQrUrl.php';

即添加:include_once __DIR__.'/src/GoogleAuthenticatorInterface.php';

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...