Take you to analyze WeChat development from the source code
In the past two days, the project needed to open an interface on WeChat, so I studied it. The process was very difficult, but the results were ideal. Now I will introduce what needs to be paid attention to in WeChat development.
1, account problem
/* First of all, you have to choose the public platform (the open platform seems to be for application integration, I haven’t studied this carefully. If anyone knows, please let me know.) On the public platform, we need to register an account. There are two types of accounts, personal type and corporate type. Among them, personal type can only apply for a subscription number, while corporate type Only then can you get a service account. Subscription accounts can only be done manually or by configuring some keywords. Service accounts can deploy some smart stuff. Advanced development permissions are required only for service accounts. So if you are an individual and want to target Reply to messages sent by users with different content, then go to sleep. */
Anyone who is engaged in development knows the meaning of the above paragraph. Yes, I commented it. When I logged in to the subscription account today, I found that the subscription account also has advanced functions. Maybe I didn’t have them at that time. Pass the review, OK, it does not hinder the sharing below.
2, development mode
It’s very simple. When you get your service account, you will find that there are There is an advanced function (there is no advanced function option in the subscription account), and you can choose which method to activate it later. Currently only one can be started for development and editing.
The WeChat interface has only one URL, and any data is connected to you through this URL The server needs to use this interface to connect (GET or POST). The following will talk about two places where it is used.
4, Verify server
After filling in your server URL, WeChat will bring several parameters to access your URL. You only need to return specific data. For specific methods, you can also check this link: http://mp.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E5%85%A5 %E6%8C%87%E5%8D%97
There are some PHP codes in the connection for reference. I will post my code below. I have taken many detours here, so I try my best. Post it in full
1 |
|
The reason why I wrote the GetReturn function is because MVC encapsulates my results. Every time I return a string, it A pair of quotation marks will be added to the outer layer, and WeChat is still stupid enough not to recognize it. . . . This function is mainly to remove the MVC encapsulation for me
1 |
|
Of course, if you carefully study what WeChat said, you can also find that when When you receive echoStr, it's OK to just return it without going through extra verification steps.
5, message receiving interface
I only focused on one function, when user We need to pay attention to a few points here: a. The ActionName of this interface is the same as the interface verified above. In this way, they use the same URL when accessed from the outside. The method is just different.1 |
|
1 |
|
variables in this interface. I used regular expressions to get them for him.
1 |
|
1 2 3 4 5 6 7 |
|
1 |
|
1 |
|
1 |
|
1 |
|
WeChat public account platform source code download
2.Xiaozhu CMS Life Tong O2O system v2.0 exclusive version download
The above is the detailed content of Take you to analyze WeChat development from the source code. For more information, please follow other related articles on 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





To update the curl version under Linux, you can follow the steps below: Check the current curl version: First, you need to determine the curl version installed in the current system. Open a terminal and execute the following command: curl --version This command will display the current curl version information. Confirm available curl version: Before updating curl, you need to confirm the latest version available. You can visit curl's official website (curl.haxx.se) or related software sources to find the latest version of curl. Download the curl source code: Using curl or a browser, download the source code file for the curl version of your choice (usually .tar.gz or .tar.bz2

The Linux kernel is an open source operating system kernel whose source code is stored in a dedicated code repository. In this article, we will analyze the storage path of the Linux kernel source code in detail, and use specific code examples to help readers better understand. 1. Linux kernel source code storage path The Linux kernel source code is stored in a Git repository called linux, which is hosted at [https://github.com/torvalds/linux](http

View steps: 1. Find the installation directory or view online; 2. Unzip the source code; 3. Use a text editor or integrated development environment; 4. Navigate and view the source code. Detailed introduction: 1. Find the installation directory or view online: If JDK is installed, you can find the Java source code in the JDK installation directory. In the JDK installation directory, there is usually a src.zip or similar compressed file, which contains the source code of the Java core class library; it is also possible to view the Java source code online, etc.

Steps to view the Tomcat source code: 1. Download the Tomcat source code; 2. Import the Tomcat source code in IDEA; 3. View the source code; 4. Understand the working principle of Tomcat; 5. Participate in the community and contribute; 6. Precautions; 7. Continuously learn and update; 8. Use tools and plug-ins. Detailed introduction: 1. To download the Tomcat source code, you first need to obtain the source code of Tomcat. You can download the source code package from the official website of Apache Tomcat, etc.

In Java, the suffix for source code files is usually .java. When writing a Java program, a source code file with a .java suffix is created, which contains the Java source code. For example, a simple Java source code file could be named MyClass.java, where MyClass is the name of the class and .java is the suffix of the file.

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.

This is a 1500-word article that explores the Linux kernel source code distribution in depth. Due to limited space, we will focus on the organizational structure of the Linux kernel source code and provide some specific code examples to help readers better understand. The Linux kernel is an open source operating system kernel whose source code is hosted on GitHub. The entire Linux kernel source code distribution is very large, containing hundreds of thousands of lines of code, involving multiple different subsystems and modules. To gain a deeper understanding of the Linux kernel source code

How can you understand the design principles and goals behind the latest PHP code specification by reading its source code? Introduction: When writing high-quality PHP code, it is very important to follow certain coding standards. Through code specifications, the readability, maintainability and scalability of the code can be improved. For the PHP language, there is a widely adopted code specification, namely PSR (PHPStandardsRecommendations). This article will introduce how to read the source code of the latest PHP code specification
