PHP微信公共号自定义菜单。
/**微信生成菜单
* [addMennu description]
*/
public function addMennu(){
$token = $this->getToken();
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$token;
$SERVER_NAME = "http://".$_SERVER['SERVER_NAME'];/*域名*/
$zhifu = $this->url."index.php?r=pay/index";
$fu = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$this->appid."&redirect_uri=".urlencode($zhifu)."&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect";
$data = '{
"button": [
{
"name": "海宇",
"sub_button": [
{
"type":"view",
"name":"支付",
"url":"'.$fu.'"
}
]
}
]
}';
return $this->sendCurl($url,$data);
}
public function sendCurl($url1,$data){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //绕过安全证书
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); //绕过安全证书
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
print_r($this->addMennu());
/**微信生成菜单 * [addMennu description] */ public function addMennu(){ $token = $this->getToken(); $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$token; $SERVER_NAME = "http://".$_SERVER['SERVER_NAME'];/*域名*/ $huoqu = $this->url."indexs.php?r=agent/code"; $qianyue = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$this->appid."&redirect_uri=".urlencode($huoqu)."&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"; $wdht = $this->url."indexs.php?r=mycontrct/code"; $myqy = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$this->appid."&redirect_uri=".urlencode($wdht)."&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"; $zhifu = $this->url."index.php?r=pay/index"; $fu = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$this->appid."&redirect_uri=".urlencode($zhifu)."&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"; $a = $this->url."index.php?r=agent/code"; $agent = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$this->appid."&redirect_uri=".urlencode($a)."&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"; $data = '{ "button": [ { "name": "海宇", "sub_button": [ { "type": "view", "name": "租赁豪宅", "url": "http://m.haiyufc.com/rent/rentAll" }, { "type": "view", "name": "委托", "url": "http://m.haiyufc.com" }, { "type":"view", "name":"支付", "url":"'.$fu.'" } ] }, { "name": "合同", "sub_button": [ { "type": "miniprogram", "name": "租赁签约", "url":"'.$qianyue.'", "appid":"wx935e38107163e960", "pagepath":"pages/index/index?typeid=1" }, { "type":"miniprogram", "name":"经纪人登陆", "url":"'.$agent.'", "appid":"wx935e38107163e960", "pagepath":"pages/index/index?typeid=2" } ] }, { "name": "关于海宇", "sub_button": [ { "type":"view", "name":"税费计算器", "url":"http://m.haiyufc.com/Mortgage/sm.html" }, { "type":"view", "name":"房贷计算器", "url":"http://m.haiyufc.com/Mortgage/Dksl.html" }, { "type":"view", "name":"招贤纳士", "url":"http://m.eqxiu.com/s/BJUmXHfy?from=singlemessage&isappinstalled=0&share_level=1&from_user=85c218ad-ec68-4329-93d2-b8fef280ef07&from_id=26875fa5-55e2-4b93-8f1b-06988424d127&share_time=1526789738908", }, { "type":"click", "name":"权证知识", "key":"V1001_GOOD" } ] } ] }'; return $this->sendCurl($url,$data); }
PHP微信公共号自定义菜单。的更多相关文章
- C#微信公众号——自定义菜单
自定义菜单最多包括3个一级菜单,每个一级菜单最多包含5个二级菜单.一级菜单最多4个汉字,二级菜单最多7个汉字,多出来的部分将会以“...”代替.自定义菜单的介绍,可以看官方开发文档http://mp. ...
- 微信公众号自定义菜单中添加emoji表情
做微信公众号开发,可能会遇到如何加入emoji表情的问题.今天在“海南旅游小管家”公众号的菜单中加入了emoji表情,特此记录备忘. 1.登录微信公众号,在左侧找到[开发者工具]菜单,点击进入,找到[ ...
- vue 仿写微信公众号自定义菜单
先看效果图 代码参考 <template> <div> <!-- 公众号设置 --> <el-col :span="24" style=& ...
- .net mvc 微信公众号 自定义菜单
官方文档:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN ...
- 通过微信公众号API复制公众号自定义菜单同时增加子菜单方法
主要的原因是再不破坏公众号以前的菜单的基础上增加自定义菜单,主要步骤如下: 1.通过微信提供的微信公众平台接口调试工具获取公众号的所有自定义菜单 网址:https://mp.weixin.qq.com ...
- 微信公共号url地址出错,调用上次设置地址.
开发微信公共号时总是会遇到要修改公共号里自定义菜单的地址,修改过后有些手机会重新请求错误(上次)的地址. 针对这个问题,我采用重新关注公共号.清楚公共号内容.清楚浏览器缓存的方式,前两种均不得解决,第 ...
- 微信公众平台自定义菜单新增扫一扫、发图片、发位置 LBS运作更便捷
今天微信公众平台发布更新,自定义菜单新增扫一扫.发图片.发送位置等功能,这对于有意挖掘微信LBS服务的运营者来说更便捷了,订阅号不用返回微信界面就能扫图.发送图片.调用地理位置,用户体验更友好,自然也 ...
- 微信公众平台自定义菜单PHP开发
微信公众平台自定义菜单PHP开发,微信公众平台自定义菜单是如何实现的呢?其实很简单,首先在微信公众平台升级为服务号,获取appid和appsecret,然后根据这2个参数获取access_token, ...
- 微信公众平台自定义菜单及高级接口PHP SDK(转)
本文介绍介绍微信公众平台自定义菜单及高级接口的PHP SDK及使用方法. 作者 方倍工作室 修正记录: 2014.05.03 v1.0 方倍工作室 http://www.cnblogs.com/txw ...
随机推荐
- 启动bind失败
systemctl start named 报错: control process exited, code=exited status=1 Failed to start Berkeley Inte ...
- 基于单片机的Wifi温度湿度测量仪
这次的制作背景是由于单片机课程实训课程要求 刚好手上有块ESP8266-12F的WiFi模块 于是就选择了制作一个基于单片机,使用WiFi传输数据的温湿度采集测量仪 制作过程: 由于有使用过WiFi模 ...
- [转].NET Framework、C#、CLR和Visual Studo之间的版本关系
原文地址:http://www.xcode.me/more/microsoft-net-framework-version-define C#版本 .NET Framework版本 CLR版本 Vis ...
- eKingCloud 从 OpenStack 到 OpenInfra 演进之路
本内容首发于 2016/06/21 北京 OpenInfra 大会上本人的演讲 发文章要求至少150个字,那就把最后一页说明一下吧. 我前面介绍了我们的5大产品,包括企业的私有云架构和实践,包括企业数 ...
- 学习笔记之Data Visualization
Data visualization - Wikipedia https://en.wikipedia.org/wiki/Data_visualization Data visualization o ...
- [转][C#]HttpClient 代码示例
转自:https://www.cnblogs.com/amosli/p/3918538.html 也参考了:https://www.cnblogs.com/ShadowFiend007/p/80668 ...
- 廖雪峰Java6IO编程-1IO基础-1IO简介
1.IO简介 IO是指Input/Output,即输入和输出: Input指从外部读取数据到内存,例如从磁盘读取,从网络读取. * 为什么要把数据读到内存才能处理这些数据呢? * 因为代码是在内存中运 ...
- keras LSTM学习实例
1. 购物时间预测 http://www.cnblogs.com/arkenstone/p/5794063.html https://github.com/CasiaFan/time_seires_p ...
- java 两个日期之间的天数
private static int numDays(String start,String end){ Calendar startCal=Calendar.getInstance(); Strin ...
- Oracle数据库类型
Oracle数据库类型 字符类型char[(length)] 定长字符 最长2000字节varchar2[(length)] 可变长度的字符数据类型,最长4000字节NCHAR[(length)] 固 ...