Overview
If you choose to develop a development version for WeChat, you cannot use the Custom menu tool in the function, and you need to add it manually using code. This article mainly introduces how to add a custom menu through http request.
Principles and Tools
If you want to add your own menu, you need to send a create menu message to a URL on WeChat. Just send once and your changes will be saved.
WeChat provides a debugging tool that can directly send the edited information to the corresponding URL. The address of the tool is here
Create Menu
First get the AccessToken. Children's shoes who don't know how to operate can refer to here
After getting the token, fill it in after the "access_token" of the tool, and then enter a format of json# in the body input box below. ##Text:
{ "button":[ { "type":"click", "name":"今日歌曲", "key":"V1001_TODAY_MUSIC" }, { "name":"菜单", "sub_button":[ { "type":"view", "name":"搜索", "url":"http://www.soso.com/" }, { "type":"view", "name":"视频", "url":"http://v.qq.com/" }, { "type":"click", "name":"赞一下我们", "key":"V1001_GOOD" }] }] }There are many types of menu buttons added, and there are only 3 or 4 commonly used ones. For more usage, please refer to the official documentation here. Send to addAfter filling in, click the button below to submit to complete the addition. It is said that there is a 24-hour delay, but it took effect immediately after I sent it. In addition, I also encountered an error report with a return code of 40001. After a while, nothing was changed, but the submission was successful. It is probably a small bug somewhere: )[Related recommendations]1.
Share the example tutorial of mini program development and calling interface
2.The example code of mini program red envelope interface development
3.Detailed explanation of mini program development using Underscore.js
4.WeChat public account development tutorial Part 14 - Custom menu creation and menu event response
5.Simple example code for small program development
The above is the detailed content of How to add custom menu via http request?. For more information, please follow other related articles on the PHP Chinese website!

如何解决Java开发中的HTTP请求连接被拒绝问题在进行Java开发中,经常会遇到HTTP请求连接被拒绝的问题。这种问题的出现可能是由于服务器端限制了访问权限,或是网络防火墙阻止了HTTP请求的访问。解决这个问题需要对代码和环境进行一些调整。本文将介绍几种常见的解决方法。检查网络连接和服务器状态首先,确认你的网络连接是正常的,可以尝试访问其他的网站或服务,看

PHP是一种广泛使用的编程语言,其中一个常见的应用就是发送电子邮件。在这篇文章中,我们将讨论如何使用HTTP请求发送邮件。我们将从以下几个方面来介绍这个主题:什么是HTTP请求发送邮件的基本原理使用PHP发送HTTP请求发送邮件的示例代码什么是HTTP请求HTTP请求是指发送到web服务器的请求,以获取web资源。HTTP是一种协议,用于在web浏览器和we

从头到尾:如何使用php扩展cURL进行HTTP请求引言:在Web开发中,经常需要与第三方API或其他远程服务器进行通信。而使用cURL进行HTTP请求是一种常见而强大的方式。本文将介绍如何使用php扩展cURL来执行HTTP请求,并提供一些实用的代码示例。一、准备工作首先,确保php已安装cURL扩展。可以在命令行执行php-m|grepcurl查

如何使用Nginx进行HTTP请求的压缩和解压缩Nginx是一款高性能的Web服务器和反向代理服务器,其功能强大且灵活。在处理HTTP请求时,可以使用Nginx提供的gzip和gunzip模块对请求进行压缩和解压缩,以减小数据传输量,提高请求响应速度。本文将介绍如何使用Nginx进行HTTP请求的压缩和解压缩的具体步骤,并提供相应的代码示例。配置gzip模块

Nginx如何实现HTTP请求的重试配置,需要具体代码示例Nginx是一款非常流行的开源反向代理服务器,它拥有强大的功能和灵活的配置选项,可以用来实现HTTP请求的重试配置。在网络通信中,由于各种原因,例如网络延迟、服务器负载等,有时候我们发起的HTTP请求可能会失败。为了提高应用程序的可靠性和稳定性,我们可能需要在请求失败时进行重试。下面将介绍如何使用Ng

如何使用golang中的http.Client进行HTTP请求的高级操作引言:在现代开发中,HTTP请求是不可避免的一部分。golang提供了强大的标准库,其中包含了http包。http包提供了http.Client结构体,用于发送HTTP请求和接收HTTP响应。在本文中,我们将探讨如何使用http.Client进行HTTP请求的高级操作,并提供具体的代码示

标题:使用Java11中的HttpClient发送HTTP请求并处理响应引言:在现代的互联网应用程序中,与其他服务器进行HTTP通信是非常常见的任务。Java提供了一些内置的工具,可以帮助我们实现这一目标,其中最新且推荐使用的是Java11中引入的HttpClient类。本文将介绍如何使用Java11中的HttpClient发送HTTP请求并处理响应,

Nginx如何实现HTTP请求的缓存控制配置Nginx作为一款高性能的Web服务器和反向代理服务器,拥有强大的缓存管理和控制功能,可以通过配置实现对HTTP请求的缓存控制。本文将针对Nginx如何实现HTTP请求的缓存控制配置进行详细介绍,并提供具体的代码示例。一、Nginx缓存配置概述Nginx的缓存配置主要通过proxy_cache模块实现,该模块提供了


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
