| 接口地址:https://www.mxnzp.com/api/qrcode/create/single | 
|---|
| 返回格式:json | 
| 请求方式:get/post | 
| 请求示例:https://www.mxnzp.com/api/qrcode/create/single?content=你好&size=500&app_id=youid&app_secret=yousecret | 
| 名称 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| app_id | string | 必填 | app_id 扫码关注公众号 | 
| app_secret | string | 必填 | app_secret 扫码关注公众号 | 
| content | string | 必填 | 生成二维码的内容 | 
| size | int | 必填 | 生成二维码的大小(不传默认为500) | 
| type | int | 必填 | 你希望返回二维码的类型:(0=下载链接 1=base64字符串) | 
| 名称 | 类型 | 说明 | 
|---|---|---|
| qrCodeUrl | string | 如果type=0 则此参数会有值,且此值会返回二维码的下载链接 | 
| content | string | 此二维码所代表的内容 | 
| type | int | 生成的二维码的输出方式 (0=下载链接 1=base64字符串) | 
| qrCodeBase64 | string | 如果type=1 则此参数会有值,且此值会返回二维码的base64字符串 | 
{
	"code": 1,
	"msg": "数据返回成功",
	"data": {
		"qrCodeUrl": "http://www.mxnzp.com/api_file/qrcode/7/2/d/d/0/9/a/e/327588b1ddb44cf7a95e43d7ad2f5b90.png",
		"content": "你好",
		"type": 0,
		"qrCodeBase64": null
	}
}| 错误码 | 说明 | 
|---|---|
| 0 | app_id或者app_secret不合法 | 
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2022/05/01 11:38
 */
class freeApi
{
    private $apiUrl;
    public function __construct()
    {
        $this->apiUrl = 'https://www.mxnzp.com/api/qrcode/create/single?content=你好&size=500&app_id=youid&app_secret=yousecret';
    }
    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}package main
import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)
const (
	APIURL   = "https://www.mxnzp.com/api/qrcode/create/single?content=你好&size=500&app_id=youid&app_secret=yousecret"
)
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))
}