What should I do if the QR code generated by php is Chinese garbled? Solution

WBOY
Release: 2016-07-25 08:53:06
Original
2233 people have browsed it
  1. $urlToEncode="http://gz.altmi.com";
  2. generateQRfromGoogle($urlToEncode);
  3. function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin ='0')
  4. {
  5. $url = urlencode($url);
  6. echo '';
  7. }
Copy code

2.php class library PHP QR Code Address: http://phpqrcode.sourceforge.net/ Download: http://sourceforge.net/projects/phpqrcode/ Example:

  1. # Create a QR code file
  2. QRcode::png('code data text', 'filename.png');
  3. # Generate an image to the browser
  4. QRcode::png('some othertext 1234' );
Copy code

3.libqrencode Address: http://fukuchi.org/works/qrencode/index.en.html For php support, please refer to: http://hirokawa.netflowers.jp/entry/4900/

4.QRcode Perl CGI & php tutorial scripts Address: http://www.swetake.com/qr/qr_cgi.html Regarding the content of QR code generated by PHP, it is introduced in many PHP tutorials. Please study it carefully. After all, this thing is very popular now. Let me share with you a complete example.

4. In the second method, add the logo in the middle of the QR code Modify the png method in the QRimage class in phpqrcode.php:

  1. public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4, $saveandprint=FALSE, $mergePic='')
  2. {
  3. $image = self::image ($frame, $pixelPerPoint, $outerFrame);
  4. if($mergePic) {
  5. $im = imagecreatefrompng($mergePic);
  6. $w = imagesx($im);
  7. $h = imagesy($im);
  8. ImageAlphaBlending ($image, true);
  9. ImageAlphaBlending($im, true);
  10. $qrw = (imagesx($image)-$w)/2;
  11. $qrh = (imagesy($image)-$h)/2;
  12. imagecopy($image, $im, $qrw, $qrh, 0, 0, $w, $h);
  13. imagedestroy($im);
  14. }
  15. if ($filename === false) {
  16. Header(" Content-type: image/png");
  17. ImagePng($image);
  18. } else {
  19. ImagePng($image, $filename);
  20. if($saveandprint===TRUE){
  21. header("Content-type: image/png");
  22. ImagePng($image);
  23. }
  24. }
  25. ImageDestroy($image);
  26. }
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!