Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add menus to Wechat by php

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "php how to add menus to Wechat", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn how to add menus to Wechat by php.

Php realizes the method of adding menus to Wechat: 1. Obtain appid and appsecret;2 through Wechat public account, obtain access_token;3 through the API for obtaining credentials, and create a custom menu through the "function createMenu ($data) {...}" method.

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

How does php add menus to Wechat?

An example of the method of creating Wechat custom menu with PHP implementation

The details are as follows:

Before using the universal interface, you need to do the following two steps:

1. Have a Wechat public account and get appid and appsecret (apply for internal test qualification on the public platform, which can be obtained after approval)

two。 Obtain the access_token through the API to obtain credentials

Note:

Access_token is a ticket for a third party to access api resources

Access_token corresponds to the official account is the globally unique ticket, repeated acquisition will invalidate the last acquired access_token.

Visit the following address (be careful to replace your appid and secret):

Https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET

Then you can see the return message in the browser:

{"access_token": "this is your access_token", "expires_in": 7200}

Create a custom menu:

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: 0

*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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report