接口地址:https://api.kuleu.com/api/qrcode |
---|
返回格式:image |
请求方式:get |
请求示例:https://api.kuleu.com/api/qrcode?frame=1&e=L&text=https://free-api.com&size=200 |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
text | string | 必填 | 需要生成二维码的内容 |
size | int | 选填 | 需要生成二维码的大小 |
名称 | 类型 | 说明 |
---|---|---|
- | - | - |
-
错误码 | 说明 |
---|---|
- | - |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2024/10/23 07:11
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://api.kuleu.com/api/qrcode?frame=1&e=L&text=https://free-api.com&size=200';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://api.kuleu.com/api/qrcode?frame=1&e=L&text=https://free-api.com&size=200"
)
func main() {
queryUrl := fmt.Sprintf("%s",APIURL)
resp, err := http.Get(queryUrl)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}