PHP code example of huaweichenai / google-authenticator
1. Go to this page and download the library: Download huaweichenai/google-authenticator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
huaweichenai / google-authenticator example snippets
$authenticator = new Authenticator();
$secret = $authenticator->createSecret();
$authenticator = new Authenticator();
$qrCodeUrl = $authenticator->getQRCodeGoogleUrl('username', $secret, 'title');
$authenticator = new Authenticator();
$authCode = $authenticator->getAuthCode('username', $secret, 'title');
$authenticator = new Authenticator();
$verifyCode = $authenticator->verifyCode($secret, 'code验证码');
if (verifyCode) {
echo '认证成功';
} else {
echo '认证失败';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.