使用Laravel或。的QR码生成器形式的随机数

时间:2016-07-19 09:12:10

标签: php laravel random numbers qr-code

我正在寻找qR CODE Genenrator,当有人访问网站并点击按钮,称为“生成代码”,应该生成Qrcode。每次新密码。

1 个答案:

答案 0 :(得分:0)

好的,这应该很容易。

//First we generate a random number
$number = rand(1,1000);
//we prepare the google charts api
$url = "http://chart.apis.google.com/chart?cht=qr&chs=150x150&chld=L|0&chl=" . $number;
//echo the qr code
echo "<img src='$url'>";

现在您只需要发出ajax请求即可在页面上获取qr代码而无需刷新。