In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "WeChat Mini Programs API how to get the page QR code". In the daily operation, I believe that many people have doubts about how WeChat Mini Programs API obtains the page QR code. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "WeChat Mini Programs API how to get the page QR code". Next, please follow the editor to study!
Get the QR code
The QR code of any page of Mini Program can be obtained through the background interface, and scanning the QR code can directly enter the corresponding page of Mini Program. Currently, Wechat supports two kinds of QR codes, mini-program code (left) and Mini Program QR code (right), as follows:
Get Mini Program Code
We recommend generating and using mini code, which is more recognizable. At present, there are two interfaces that can generate small code, and developers can choose the appropriate interface according to their own needs.
Interface A: suitable for business scenarios where a small number of codes are required
Interface address:
Https://api.weixin.qq.com/wxa/getwxacode?access_token=ACCESS_TOKEN
For more information on how to obtain access_token, please see the documentation.
POST parameter description
The default value of the parameter type indicates that pathString cannot be empty, and the width of the maximum length 128byte widthInt430 QR code auto_colorBoolfalse automatically configures the line color. If the color is still black, it is not recommended to configure the main tone line_colorObject {"r": "0", "g": "0", "b": "0"} when auth_color is false. Use rgb to set colors such as {"r": "xxx", "g": "xxx", "b": "xxx"}
Note: the mini code generated through this API is permanently valid. The quantity limit is described at the end of the document. Please use it with caution. After the user scans the code to enter Mini Program, they will directly go to the corresponding page of path.
Interface B: suitable for business scenarios that require a large number of codes or are only used temporarily
Interface address:
Https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=ACCESS_TOKEN
For more information on how to obtain access_token, please see the documentation.
POST parameter description
The default value of parameter type indicates that sceneString has a maximum of 32 visible characters and only supports numbers, uppercase and lowercase English, as well as some special characters:! # $&'() * +, /: =? @ -. _ ~, please encode other characters as legal characters (because urlencode cannot be used in Chinese, please use other encoding methods) pageString must be a published Mini Program page, such as "pages/index/index". If this field is left empty, the width of the widthInt430 QR code of the main page auto_colorBoolfalse automatically configures the line color by default, if the color is still black. It is not recommended to configure line_colorObject {"r": "0", "g": "0", "b": "0"} when auto_color is false. Use rgb to set colors such as {"r": "xxx", "g": "xxx", "b": "xxx"}.
Note: the mini code generated through this interface is permanently valid, and the quantity is unlimited for the time being. After the user scans the code and enters Mini Program, the developer needs to obtain the value of the scene field in the code on the corresponding page, and then do the processing logic. Use the following code to get the value of the scene field in the QR code. During the debugging phase, the development tool's conditional compilation custom parameter scene=xxxx can be used for simulation, and the parameter value of scene during the development tool simulation needs to be urlencode.
/ / this is the jsPage on the home page ({onLoad: function (options) {/ / scene in options needs to use decodeURIComponent to get the scenevar scene = decodeURIComponent (options.scene)}} passed when the QR code is generated) to get the Mini Program QR code
Interface C: suitable for business scenarios with a small number of codes required
Interface address:
Https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN
For more information on how to obtain access_token, please see the documentation.
POST parameter description
The default value of the parameter type indicates that pathString cannot be empty, and the width of the maximum length of 128byte widthInt430 QR code
Note: the Mini Program QR code generated through this API is valid forever. The quantity limit is described at the end of the document. Please use it with caution. After the user scans the code to enter Mini Program, they will directly go to the corresponding page of path.
Example:
{"path": "pages/index?query=1", "width": 430}
Note: pages/index needs to be defined in the pages of app.json
Bug & Tip
Tip: through this API, only the QR codes of the published Mini Program can be generated.
Tip: you can generate the development version of the QR code with parameters when the developer tool previews.
Tip: the total number of codes generated by API A plus interface C is limited to 1004.000. Please call it carefully.
The tip: POST parameter needs to be converted to a json string, and form form submission is not supported.
The tip: auto_color line_color parameter takes effect only for mini codes.
At this point, the study on "WeChat Mini Programs API how to get the page QR code" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 256
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.