{function qr_code($aid,$widhtHeight ='150',$EC_level='L',$margin='0'){$arr = GetOneArchive($aid);if($arr['arcurl']){$str = urlencode($arr['arcurl']);}else{$str = urlencode($GLOBALS['cfg_phpurl'].'/view.php?aid='.$aid);}return '<img src="http://chart.apis.google.com/chart?chs='.$widhtHeight.'x'.$widhtHeight.'&cht=qr&chld='.$EC_level.'|'.$margin.'&chl='.$str.'" alt="QR code" widhtHeight="'.$widhtHeight.'" widhtHeight="'.$widhtHeight.'"/>';}} |
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);}调用PHP QR Code非常简单,如下代码即可生成一张内容为"http://www.bnxb.com"的二维码.Php代码 include 'phpqrcode.php'; QRcode::png('http://www.bnxb.com'); |
新闻热点
疑难解答