直接上代码
开启谷歌验证 分配秘钥 生成二维码
$ga = new \PHPGangsta_GoogleAuthenticator();
$secret = $ga->createSecret();
$aaccount = $memberInfo['phone'] ? $memberInfo['phone'] : $memberInfo['email'];
$googleurl='otpauth://totp/'.$aaccount.'?secret='.$secret.'&issuer=name';
输入谷歌验证器上的验证码 调用对应验证
$ga = new \PHPGangsta_GoogleAuthenticator();
$oneCode = I('post.oneCode');
$checkResult = $ga->verifyCode($info['google_code'], $oneCode, 2);