PHP generated two-dimensional code Chinese garbled what to do? Workaround

Source: Internet
Author: User
    1. $urlToEncode = "http://gz.altmi.com";
    2. Generateqrfromgoogle ($urlToEncode);
    3. function Generateqrfromgoogle ($chl, $widhtHeight = ' Max ', $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/use case:

    1. # Create a two-dimensional code file
    2. QRCode::p ng (' Code data text ', ' filename.png ');
    3. # Generate image to browser
    4. QRCode::p ng (' some othertext 1234 ');
Copy Code

3.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:

    1. public static function png ($frame, $filename = False, $pixelPerPoint = 4, $outerFrame = 4, $SAVEANDPR Int=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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.