PHP generates a QR code. I personally think there are two most common types: 1. use the google api to generate, 2. use php qr Code generation. The QR Code generated in both methods is clear and effective. The following describes how these two methods are implemented.
I. PHP uses google api to generate a QR code online:
Let's not talk about this API. You can go to Google's official website for query. I believe you are concerned with the specific code, as shown below:
1
2 $ urlToEncode = "http://www.csdn.net"; // URL of the QR code to be generated
3 generateQRfromGoogle ($ urlToEncode );
4 function generateQRfromGoogle ($ chlorophyll, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
5 {
6 $ url = urlencode ($ url );
7 echo'
'; // The Google API. If the API fails, you can query the latest API on the Google website.
8}
9?>
Ii. Use php qr Code to generate a QR Code:
1
2 include "phpqrcode. php"; // introduce the php qr Library File
3 $ value = "http://www.csdn.net ";
4 $ errorCorrectionLevel = "L ";
5 $ matrixPointSize = "4 ";
6 QRcode: png ($ value, false, $ errorCorrectionLevel, $ matrixPointSize );
7 exit;
8?>
Php qr Code is an open-source php QR Code open-source library. It is based on the libqrencode C library and provides API Code to create QR Code images. It supports png and jpg formats. If you do not have this library, you can download it here: php qr Code generation Library