- 
           
二维码生成识别
[C#]- https://www.6api.net/api/qrcode/
 - 阅读数:79094 上传时间:2020-11-21
 
 
- 示例代码
 
本代码示例是基于C#的六派数据接口进行数据请求 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/qrcode/ 申请API服务
以下是完整代码示例:
class Response
{
  public string statusCode;
}
static void Main(string[] args)
{
  string method = "POST";
  string url = "http://open.liupai.net/qrcode/qrcode";
  Dictionary<string, string> param = new Dictionary<string, string>();
     param.Add("appkey", "yourappsecret");
     param.Add("text", "参数1");//二维码内容
     param.Add("bgcolor", "#FFFFFF");//背景色 默认FFFFFF白色
     param.Add("fgcolor", "#000000");//前景色 默认000000黑色
     param.Add("level", "L");//纠错等级 L M Q H 从低到高 默认L
     param.Add("width", "300");//大小 默认 300
     param.Add("margin", "参数6");//边距 包含在宽度里面 默认0
     param.Add("logo", "参数7");//LOGO地址 http
  Dictionary<string, string> headers = null;
  string result = api_send_request(method, url, param, headers);
  if (result == "")
  {
      //返回内容异常,发送请求失败
      Console.WriteLine("发送请求失败");
      return;
  }
  Response res = new JavaScriptSerializer().Deserialize<Response>(result);
  if (res.statusCode == "200") //有个别接口计费状态码为其他