图片下载
public function generateQRCode($id){$result = SenceQrcodeInfo::find($id,['qrcode_content','id']);
$url = "http://weixin.qq.com/q/02_lvVoNRJe7h10000003X";
//echo "<img src=\"data:image/png;base64,".base64_encode(QrCode::format('png')->size(300)->generate($url))."\">";
return response()->stream(function() use($result){echo QrCode::format('png')->size(200)->generate($result->qrcode_content);
}, 200, ["Content-type"=>"image/png","Content-Disposition"=>"attachment; filename=hello.png"]);
}
图片在线预览
public function generateQRCode($id){$result = SenceQrcodeInfo::find($id,['qrcode_content','id']);
$url = "http://weixin.qq.com/q/02_lvVoNRJe7h10000003X";
//echo "<img src=\"data:image/png;base64,".base64_encode(QrCode::format('png')->size(300)->generate($url))."\">";
return response()->stream(function() use($result){echo QrCode::format('png')->size(200)->generate($result->qrcode_content);
}, 200, ["Content-type"=>"image/png"]);
}