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 ...
随机推荐
- [蓝桥杯]ALGO-8.算法训练_操作格子
题目描述: 问题描述 有n个格子,从左到右放成一排,编号为1-n. 共有m次操作,有3种操作类型: .修改一个格子的权值, .求连续一段格子权值和, .求连续一段格子的最大值. 对于每个2.3操作输出 ...
- 查看app日志的方法
可以打开SDk里面的 ddms.bat 查看日志 路径: android-sdk-macosx/tools/ddms SDK下载的地址: http://www.androiddevtools.cn/ ...
- 使用jquery方法的时候,要注意对象是哪个,否则很容易出错
<!DOCTYPE html><html><head><meta charset="utf-8"><title>W3Cs ...
- IDC:IDC 清单
ylbtech-IDC:IDC 清单 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返回顶部 作者:ylbtech出处:http://ylbte ...
- H5移动端开发vue+vux
项目src中用到的npm包有(从编译打包到最终部署仍不能移除)1:vue 渐进式 JavaScript 框架 http://cn.vuejs.org/v2/guide/2: ...
- Centos7下的systemctl命令与service和chkconfig
博主使用的操作系统是最新的CentOS 7,所以可能和网上一些老的博文有一定出入,那是因为版本更新的原因. 这里写图片描述1 service service命令用于对系统服务进行管理,比如启动(sta ...
- sas 命令行打开SAS IDE 的代码
"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHom ...
- Linux程序的执行
一.多任务协调机制 $ find /boot | cpio -ocB > /tmp/boot.img 程序执行方式——流式处理 “|”是匿名管道 管道分匿名管道,命名管道.匿名管道属于临时工,随 ...
- (转)利用WPF的ListView进行大数据量异步加载
原文:http://www.cnblogs.com/scy251147/archive/2012/01/08/2305319.html 由于之前利用Winform的ListView进行大数据量加载的时 ...
- opencv 基础数据结构
头文件:cxcore/include/cxtypes.h CvPoint: CvPoint:(构造cvPoint) CvPoint2D32f: CvPoint3D32f: CvSize: CvSize ...