模块PHP代码中添加HTML代码,例如:

店铺二维码 <img src="<?=getErcode($_shop->id,90,4)?>"/></div>
商品二维码 <img src="<?=getErcode($item['id'],70,2)?>

(二维码数据:1为集市商品,2为天猫商品,3为集市店铺,4为天猫店铺,5为微淘)

//生成二维码
function getErcode($erId, $widthHeight = "90", $type = "1") {
    switch($type){
    case 1:
    $code = 'type=ci&item_id='.$erId.'&v=1';break;
    case 2:
    $code = 'v=1&type=bi&item_id='.$erId;break;
    case 3:
    $code = 'type=cs&shop_id='.$erId.'&v=1';break;
    case 4:
    $code = 'v=1&type=bs&shop_id='.$erId;break;
    case 5:
    $code = 'type=we&we_id='.$erId.'&v=1';break;
    default:
    $code = 'type=ci&item_id='.$erId.'&v=1';
    }
    $imgsrc = 'http://gqrcode.alicdn.com/img?'.$code.'&w='.$widthHeight.'&h='.$widthHeight;
    return $imgsrc;
}
最后编辑: admin  文档更新时间: 2020-05-20 16:13   作者:admin