Laravel实时生成图片

public function generateQRCode($id){
        $result = SenceQrcodeInfo::find($id,['qrcode_content','id']);
        $url = "http://weixin.qq.com/q/02_lvVoNRJe7h10000003X";
        //echo "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"]);
    }

你可能感兴趣的:(Laravel实时生成图片)