


WeChat development—WeChat development environment construction
Currently mobile development is a relatively hot trend, and many developers are eager to try it. Currently, the field of mobile App development is mainly divided into the following types
In my daily work, I come into contact more with Native App development based on Android and Light App development based on WeChat official accounts. Today I will lead you to quickly enter the development field of WeChat official accounts. .
1. Setting up WeChat development environment
If a worker wants to do his job well, he must first sharpen his tools. If you want to develop a WeChat public account, you must first prepare two essential things:
1. Have a public account for testing.
2. Development environment used to debug the code.
1.1. Register and test public accounts
WeChat public accounts are divided into service accounts, subscription accounts, and enterprise accounts. Subscription accounts can be applied for by individuals. Service accounts and enterprise accounts must have enterprise qualifications.
What we call WeChat public account development refers to subscription accounts and service accounts.
Regarding the difference between subscription account and server, the official explanation is this
Service account : Mainly biased towards service interaction (functions are similar to 12315, 114, bank, providing binding (customized information, service interaction), can send 4 messages per month; service number Applicable people: media, enterprises, governments or other organizations.
Subscription account : Mainly focuses on conveying information to users (functions similar to newspapers and magazines, providing users with news information or entertainment and interesting things), and can send 1 message in groups every day; subscription account Applicable people: individuals, media, businesses, governments or other organizations.
Personal subscription accounts have some interfaces that do not have permissions, which means that personal subscription accounts cannot call some advanced permission interfaces. The following figure is a list of permissions that my personal subscription account has, as shown in the figure below:
And some advanced interfaces, such as generating QR codes, web page authorization, custom menus, WeChat payment, and other interface permissions, personal subscription accounts do not have calling permissions, as shown above Those interfaces framed in red cannot be called by personal subscription accounts.
Fortunately, WeChat public platform provides a test public account . The registration address of the test public account is: http://mp .weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login, you only need to go to this page, click to log in, scan the code with your own WeChat client, and authorize the login. You can get your own test public account. The test public account has almost all interfaces, so when you usually learn WeChat public account development, you can register a test public account, and then use this test public account for development. . No more nonsense, let’s register a test public account first
Visit http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login and register a test public account .
The steps to register a test public account are as shown below:
Scan with WeChat Use the above QR code to log in. After successful login, you can see the information about the test public account assigned to us by Tencent, as shown in the figure below:
Test public The interface permissions owned by the number are as follows:
It can be seen that the test official account has most of the interface calling permissions, so It is completely possible to use the test official account to learn WeChat development.
1.2. Build WeChat local debugging environment
The biggest pain point in developing applications based on WeChat official accounts is debugging. Every time a function is implemented, it needs to be deployed to a public network server. Test, because every time a WeChat user initiates a request to an official account, the WeChat server will first receive the user's request and then forward it to our server. In other words, the WeChat server needs to interact with our server over the network, so We must ensure that our server can be accessed from the external network. This method of deploying to a public server for testing is simply a nightmare for us developers. So we have to think of a way to deploy locally and debug the code locally. To do this, the problem we have to solve is to map the deployment server of the internal network to the external network so that the WeChat server can be accessed normally. Fortunately What's amazing is that we can do it with the help of the third-party software Ngrok. Ngrok is a free software Ngrok. After using Ngrok, we can achieve intranet penetration, which means that we can map the intranet server to the external network for others to access , This is very fast and helpful for us to debug WeChat code in the local development environment and demonstrate something to users, because we can directly use our own intranet computer as the server.
A better website that provides Ngrok services in China is: http://natapp.cn/, as shown in the figure below:
From http://natapp.cn /Download the ngrok client on the website, as shown in the figure below:
After the download is completed, you will get a compressed package. After decompressing the compressed package, you will get a folder, which contains the contents as shown in the figure below. Several files:
Open the CMD command line window, enter the ngrok_windows directory, and then enter the following command:
ngrok -config ngrok.cfg -subdomain xdp 8080 , as shown in the figure below:
:8080 server is mapped to the external network, as shown in the following figure:
At this time, users on the external network can directly access the domain name http://xdp.ngrok.natapp.cn The 127.0.0.1:8080 server on my intranet is as shown in the figure below:
After using ngrok, we can The intranet server is used as a public network server. The access speed is still within an acceptable range. As of now, ngrok is available and the WeChat public account server is accessible. In this way Once it comes, it won’t hinder us from doing local adjustments. At this point, our WeChat local debugging and development environment has been set up. With tall buildings rising from the ground, we have taken the first step in WeChat development! For more WeChat development—WeChat development environment construction related articles, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP is an open source scripting language that is widely used in web development and server-side programming, especially in WeChat development. Today, more and more companies and developers are starting to use PHP for WeChat development because it has become a truly easy-to-learn and easy-to-use development language. In WeChat development, message encryption and decryption are a very important issue because they involve data security. For messages without encryption and decryption methods, hackers can easily obtain the data, posing a threat to users.

With the popularity of WeChat, more and more companies are beginning to use it as a marketing tool. The WeChat group messaging function is one of the important means for enterprises to conduct WeChat marketing. However, if you only rely on manual sending, it is an extremely time-consuming and laborious task for marketers. Therefore, it is particularly important to develop a WeChat mass messaging tool. This article will introduce how to use PHP to develop WeChat mass messaging tools. 1. Preparation work To develop WeChat mass messaging tools, we need to master the following technical points: Basic knowledge of PHP WeChat public platform development Development tools: Sub

In the development of WeChat public accounts, user tag management is a very important function, which allows developers to better understand and manage their users. This article will introduce how to use PHP to implement the WeChat user tag management function. 1. Obtain the openid of the WeChat user. Before using the WeChat user tag management function, we first need to obtain the user's openid. In the development of WeChat public accounts, it is a common practice to obtain openid through user authorization. After the user authorization is completed, we can obtain the user through the following code

As WeChat becomes an increasingly important communication tool in people's lives, its agile messaging function is quickly favored by a large number of enterprises and individuals. For enterprises, developing WeChat into a marketing platform has become a trend, and the importance of WeChat development has gradually become more prominent. Among them, the group sending function is even more widely used. So, as a PHP programmer, how to implement group message sending records? The following will give you a brief introduction. 1. Understand the development knowledge related to WeChat public accounts. Before understanding how to implement group message sending records, I

How to use PHP to develop WeChat public accounts WeChat public accounts have become an important channel for promotion and interaction for many companies, and PHP, as a commonly used Web language, can also be used to develop WeChat public accounts. This article will introduce the specific steps to use PHP to develop WeChat public accounts. Step 1: Obtain the developer account of the WeChat official account. Before starting the development of the WeChat official account, you need to apply for a developer account of the WeChat official account. For the specific registration process, please refer to the official website of WeChat public platform

WeChat is currently one of the social platforms with the largest user base in the world. With the popularity of mobile Internet, more and more companies are beginning to realize the importance of WeChat marketing. When conducting WeChat marketing, customer service is a crucial part. In order to better manage the customer service chat window, we can use PHP language for WeChat development. 1. Introduction to PHP WeChat development PHP is an open source server-side scripting language that is widely used in the field of Web development. Combined with the development interface provided by WeChat public platform, we can use PHP language to conduct WeChat

In the development of WeChat public accounts, the voting function is often used. The voting function is a great way for users to quickly participate in interactions, and it is also an important tool for holding events and surveying opinions. This article will introduce you how to use PHP to implement WeChat voting function. Obtain the authorization of the WeChat official account. First, you need to obtain the authorization of the WeChat official account. On the WeChat public platform, you need to configure the API address of the WeChat public account, the official account, and the token corresponding to the public account. In the process of our development using PHP language, we need to use the PH officially provided by WeChat

With the development of the Internet and mobile smart devices, WeChat has become an indispensable part of the social and marketing fields. In this increasingly digital era, how to use PHP for WeChat development has become the focus of many developers. This article mainly introduces the relevant knowledge points on how to use PHP for WeChat development, as well as some of the tips and precautions. 1. Development environment preparation Before developing WeChat, you first need to prepare the corresponding development environment. Specifically, you need to install the PHP operating environment and the WeChat public platform
