本文介绍了用PHP动态生成QR码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的网站上生成QR码.他们要做的就是在其中包含一个URL,该URL将在我的网站上提供.最简单的方法是什么?
解决方案
除了,Google提供了 QR代码API . /p>
要使用this,基本上是:
https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8
-
300x300
是要生成的QR图像的大小, -
chl
是您要更改为QR码的URL编码的字符串,并且 -
choe
是(可选)编码.
上面的链接提供了更多细节,但是要使用它,只需将图像的src
指向操纵值,就像这样:
<img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8" title="Link to Google.com" />
演示:
I'm trying to generate QR codes on my website. All they have to do is have a URL in them, which a variable on my site will provide. What would be the easiest way to do this?
解决方案
It's worth adding that, in addition to the QR codes library posted by @abaumg, Google provides a QR Codes API.
To use this , basically:
https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8
300x300
is the size of the QR image you want to generate,- the
chl
is the url-encoded string you want to change into a QR code, and - the
choe
is the (optional) encoding.
The link, above, gives more detail, but to use it just have the src
of an image point to the manipulated value, like so:
<img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8" title="Link to Google.com" />
Demo:
这篇关于用PHP动态生成QR码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!