- $urlToEncode = "http://gz.altmi.com";
- Generateqrfromgoogle ($urlToEncode);
- function Generateqrfromgoogle ($chl, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 ')
- {
- $url = UrlEncode ($url);
- Echo ';
- }
Copy Code2.php Class Library PHP QR code address: http://phpqrcode.sourceforge.net/Download: http://sourceforge.net/projects/phpqrcode/use case:
- # Create a two-dimensional code file
- QRCode::p ng (' Code data text ', ' filename.png ');
- # Generate image to browser
- QRCode::p ng (' some othertext 1234 ');
Copy Code3.libqrencode Address: http://fukuchi.org/works/qrencode/index.en.htmlphp support please refer to: http://hirokawa.netflowers.jp/entry/4900/ 4.QRcode Perl CGI & PHP Tutorials Scripts Address: Http://www.swetake.com/qr/qr_ Cgi.html about PHP generated two-dimensional code content, in a lot of PHP tutorials are introduced, we seriously study, after all, now this thing is very fire below for everyone to share a complete example. Four, the 2nd method in the middle of the QR Code plus logo Modify the PNG method in the Qrimage class in phpqrcode.php:
-
- public static function png ($frame, $filename = False, $pixelPerPoint = 4, $outerFrame = 4, $SAVEANDPR Int=false, $mergePic = ')
- {
- $image = Self::image ($frame, $pixelPerPoint, $outerFrame);
- if ($mergePic) {
- $im = imagecreatefrompng ($mergePic);
- $w = Imagesx ($im);
- $h = Imagesy ($im);
- imagealphablending ($image, true);
- imagealphablending ($im, true);
- $QRW = (Imagesx ($image)-$w)/2;
- $qrh = (Imagesy ($image)-$h)/2;
- imagecopy ($image, $im, $QRW, $QRH, 0, 0, $w, $h);
- Imagedestroy ($im);
- }
- if ($filename = = = False) {
- Header ("Content-type:image/png");
- imagepng ($image);
- } else {
- imagepng ($image, $filename);
- if ($saveandprint ===true) {
- header ("Content-type:image/png");
- imagepng ($image);
- }
- }
- Imagedestroy ($image);
- }
Copy Code |