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