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?
31 18 | |||||||||
|
68 | It's worth adding that, in addition to the QR codes library posted by @abaumg, Google provides a To use this , basically: 正确答案
The link, above, gives more detail, but to use it just have the
Demo: | ||||||||||||||||||||
|
43 | The easiest way to generate QR codes with PHP is the phpqrcode library. | ||||||||||||
|
7 | The phpqrcode library is really fast to configure and the API documentation is easy to understand. In addition to abaumg's answer I have attached 2 examples in 1. QR code encoder first include the library from your local path
then to output the image directly as PNG stream do for example:
to save the result locally as a PNG image:
2. QR code decoder See also the zxing decoder: http://zxing.org/w/decode.jspx Pretty useful to check the output. 3. List of Data format A list of data format you can use in your QR code according to the data type :
more data type on http://blog.thenetimpact.com/2011/07/decoding-qr-codes-how-to-format-data-for-qr-code-generators/ | ||||||||||||||||||||
|
3 | I have been using google qrcode api for sometime, but I didn't quite like this because it requires me to be on the Internet to access the generated image. I did a little comand-line research and found out that linux has a command line tool I wrote this little script. And the good part is that the generated image is less than 1KB in size. Well the supplied data is simply a url.
Then in the html I load the image:
You just need to have installed it. [most imaging apps on linux would have installed it under the hood without you realizing. | ||
0 | I know the question is how to generate QR codes using PHP, but for others who are looking for a way to generate codes for websites doing this in pure javascript is a good way to do it. The jquery-qrcodejquery plugin does it well. | ||
0 | qrcode-generator on Github. Simplest script and works like charm. |