## 二维码生成 >[danger]### 免费接口,每日100次免费调用,会员可不限次数调用,购买[API会员](https://market.topthink.com/product/210) ![](https://img.kancloud.cn/2a/ec/2aec98c77556f1d673b6252ff5c380f5_198x200.png =120x) > 按照设定的参数、生成二维码 每日100次免费调用 ## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086)) ### 请求地址 ``` GET https://api.topthink.com/qrcode/index ``` ### 请求参数 | 名称 | 必填 | 类型 | 说明 | | --- | --- | --- | --- | | appCode| 是 |string| 用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | text | 否 | string | 二维码内容 | | el | 否 | string | 纠错等级,el可用值:h\\q\\m\\l,例如:h | | bgcolor | 否 | string | 背景色代码,例如:ffffff | | fgcolor | 否 | string | 前景色代码,例如:000000 | | logo | 否 | string | logo图片URL地址或base64encode编码的图片内容,需要urlencode | | w | 否 | int | 尺寸大小(像素),例如:300 | | m | 否 | int | 边距大小(像素),例如:10 | | lw | 否 | int | logo宽度(像素),例如:60 | | type | 否 | int | 返回模式,1:二维码图片以base64encode编码返回 2:直接返回二维码图像,默认1 | ### 返回`data`参数 | 名称 | 类型 | 说明 | | --- | --- | --- | | 见JSON返回示例 | \- | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->qrcodeIndex() ->withText('二维码内容') ->withBgcolor('ffffff') ->withFgcolor('000000') ->withLogo() ->withW() ->withM() ->withType() ->request(); ``` 返回示例: ~~~ { "message": "success", "data": { "base64_image": "base64encode编码的二维码图片内容" }, "code": 0 } ~~~