PHP uses QRCode to easily implement QR code scanning and downloading. as the Android platform starts, many excellent third-party app markets have emerged in China. they all provide a QR code downloading function, this is a user-friendly feature. you can use your HTC or Motorola Android mobile phone to enable WIFI, install a QR code scanning software, and use the camera to use PHP to easily scan and download QR codes.
With the launch of the Android platform, many excellent third-party app markets have emerged in China. they all provide a QR code download function, which is a user-friendly function, take your HTC or Motorola Android phone, turn on WIFI, install a QR code scanning software, use the camera function to scan the QR code, and then download and install it directly, some time ago, because of the website host of an Android app of the company, PHP was used to implement this function. This article will summarize and help friends who need this function.
There are already several implementation methods on the Internet, such as using Google open APIs and libqrencode. This article will mainly discuss how to use PHP's excellent open-source QRcode library to implement this function, which greatly simplifies our work, all we need to do is download the source code package and include it in your project. This function can be done with only one line of code.
1. download the source code package:
Address: http://phpqrcode.sourceforge.net/
Download: http://sourceforge.net/projects/phpqrcode/
2. introduce to your php file
There are two methods, one is to use qrlib. the php file reads all class libraries in the form of plug-ins, and the other is the phpqrcode. php file. this is a merged version. all the class libraries are included in this file. if your server has installed the APC cache, you can use this class library to improve efficiency.
The parameter configuration is directly modified in the qrconfig. php file. Generally, only two constants are modified.
Define ('QR _ cacheable', true); // whether to use cache define ('QR _ CACHE_DIR ', $ console. DIRECTORY_SEPARATOR. 'cache'); // modify your own cache directory to ensure that the directory is writable.
3. generate a QR code image
QRcode::png('http://www.pfanr.com/download/'.$pid.'.html','/data/webroot/images/ddd.png',);
Input two parameters: the download address and the address generated by the QR code image ,? A line of code will deal with this user-friendly function.
Source from: http://www.itkuaixun.com/news/article/46171.html
?