PHP QRCode Example

Source: Internet
Author: User

Source code has a bug, causing the QR code can not be saved and output at the same time, roughly 3093 lines, the source code is

public static function png ($text, $outfile = False, $level = qr_eclevel_l, $size = 3, $margin = 4, $saveandprint =false)
{
$enc = Qrencode::factory ($level, $size, $margin);
Return $enc->encodepng ($text, $outfile, $saveandprint =false);
}

Here $saveandprint has been given the default value by the PNG function, where the value is passed to the default value will cause it to always accept the value is false, so to remove the =false line.

<?PHPinclude' Phpqrcode.php ';$url= ' http://www.baidu.com/';$error _level= ' L ';$size= 10;/*where the parameter $text represents the generation of two-bit information text, the parameter $outfile indicates whether the output QR code picture file, the default is no, the parameter $level represents fault tolerance, that is, the covered area can also be identified, respectively L (qr_eclevel_l,7%), M (qr_ eclevel_m,15%), Q (qr_eclevel_q,25%), H (qr_eclevel_h,30%), parameter $size to generate picture size, default is 3, parameter $margin indicates the spacing value of the border space around the two-dimensional code; parameter $ Saveandprint indicates whether or not to save the QR code and display it. PNG ($text, $outfile = False, $level = qr_eclevel_l, $size = 3, $margin = 4, $saveandprint =false)*//***phpqrecode output QR code image * @text is the URL parameters in the above code, * @outfile default to No, do not generate files, only the two-dimensional code image returned, otherwise you need to store the path to generate a picture of the QR code * @level default is L, The values that this parameter can pass are L (qr_eclevel_l,7%), M (qr_eclevel_m,15%), Q (qr_eclevel_q,25%), H (qr_eclevel_h,30%), respectively. This parameter controls the fault tolerance of the two-dimensional code, and different parameters indicate the percentage of the area that the QR code can be overwritten. * @size default is 3, control the size of the generated picture * @margin default is 4, control the size of the white space to generate the QR code * @saveandprint default is False, save the QR code picture and display, $outfile must pass the picture path. */QRCode::p ng ($url, ' Recode.png ',$error _level,$size, 0,true);?>

PHP QRCode Example

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.