没有合适的资源?快使用搜索试试~ 我知道了~
首页小程序带参数二维码生成 c#后台代码
小程序带参数二维码生成 c#后台代码
需积分: 15 345 浏览量
更新于2023-05-26
评论
收藏 209KB PDF 举报
微信小程序获取小程序页面二维码API接口,通过后台post网址https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN, 获取access_token方式,参数{"path": "pages/index/index?query=1", "width": 260},可以获得图片二进制流,直接打印二进制流为乱码 (此图片来源于网络,如有侵权,请联系删除! ) 该二进制流直接保存成png图片,一下为本人所写的部分核心代码,需要引用using system.net /// url 网址
资源详情
资源评论
资源推荐

小程序带参数二维码生成小程序带参数二维码生成 c#后台代码后台代码
微信小程序获取小程序页面二维码API接口,通过后台post网址https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?
access_token=ACCESS_TOKEN,
获取access_token方式,参数{"path": "pages/index/index?query=1", "width": 260},可以获得图片二进制流,直接打印二进制
流为乱码
(此图片来源于网络,如有侵权,请联系删除! )
该二进制流直接保存成png图片,一下为本人所写的部分核心代码,需要引用using system.net
/// url 网址 || param 参数
1. public static string PostMoths(string url, string param)
2. {
3. string strURL = url;
4. System.Net.HttpWebRequest request;
5. request = (System.Net.HttpWebRequest)WebRequest.Create(strURL);
6. request.Method = "POST";
7. request.ContentType = "application/json;charset=UTF-8";
8. string paraUrlCoded = param;
9. byte[] payload;
10. payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
11. request.ContentLength = payload.Length;
12. Stream writer = request.GetRequestStream();
13. writer.Write(payload, 0, payload.Length);
14. writer.Close();
15. System.Net.HttpWebResponse response;
16. response = (System.Net.HttpWebResponse)request.GetResponse();
17. System.IO.Stream s;
18. s = response.GetResponseStream();
19. string StrDate = "";
20. string strValue = "";
21. byte[] tt = StreamToBytes(s);
22. //将流保存在c盘test.png文件下
23. System.IO.File.WriteAllBytes(@"c: est.png", tt);
24. }
25. ///将数据流转为byte[]
26. public static byte[] StreamToBytes(Stream stream)
27. {
28. List bytes = new List();
29. int temp = stream.ReadByte();
30. while (temp != -1)
31. {
32. bytes.Add((byte)temp);
33. temp = stream.ReadByte();
34. }
















weixin_38677936
- 粉丝: 3
- 资源: 955
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
最新资源
- ARM Cortex-A(armV7)编程手册V4.0.pdf
- ABB机器人保养总结解析.ppt
- 【超详细图解】菜鸡如何理解双向链表的python代码实现
- 常用网络命令的使用 ipconfig ping ARP FTP Netstat Route Tftp Tracert Telnet nslookup
- 基于单片机控制的DC-DC变换电路
- RS-232接口电路的ESD保护.pdf
- linux下用time(NULL)函数和localtime()获取当前时间的方法
- Openstack用户使用手册.docx
- KUKA KR 30 hA,KR 60 hA机器人产品手册.pdf
- Java programming with JNI
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

评论0