[英]Is it possible to add watermark to QR code generated by google charts api
[英]google QR code not generated
我正在使用Google Authenticator处理身份验证表单。 用户首次登录时,将生成QR码。 QR码应该在我的页面上可见。 问题是,仅当我从网址栏浏览链接时才能生成QR码,而从网址重定向不会生成该代码。 有没有解决此问题的方法?
这是可以在Google身份验证器中找到以生成QR码的代码:
public function getUrl($user, $hostname, $secret) {
$url = sprintf("otpauth://totp/%s@%s?secret=%s", $user, $hostname, $secret);
$encoder = "https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=";
$encoderURL = sprintf( "%sotpauth://totp/%s@%s%%3Fsecret=%s",$encoder, $user, $hostname, $secret);
return $encoderURL;
}
这是我请求网址的地方:
<?php
$linkQR = $g->getUrl($user,$location,$secret);
?>
<a href="<?php echo $linkQR;?>"><img style="border: 0; padding:10px" src="<?php echo $linkQR;?>"/></a>
我找到了解决问题的方法。 在网址中使用https://chart.googleapis.com/代替https://www.google.com/生成已解决的问题。 现在,我的代码在首页加载时生成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.