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 ...
随机推荐
- C++进阶--命名空间和关键字using
//############################################################################ /* * C++关键字:using * * ...
- 【Mysql】mysql使用触发器创建hash索引
概述 若设计的数据表中,包含较长的字段,比如URL(通常都会比较长),查询时需要根据该字段进行过滤: select * from table_xxx where url = 'xxxxxxx'; 为了 ...
- Android开发之内部类篇
内部类: 1.内部类的第一个好处,隐藏你不想让别人知道的操作,也即封装性. 2.非静态内部类对象有着指向其外部类对象的引用 等等. 创建项目: 1.File---->New----->ja ...
- PAT 乙级 1051 复数乘法 (15) C++版
1051. 复数乘法 (15) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 复数可以写成(A + Bi)的常规 ...
- DevOps利器- Hygieia平台开发部署
前言碎语 Hygieia是什么? Capitalone(全美十大银行之一)开源的DevOps利器.使用Hygieia后,在整个软件开发周期中,用户可以选择VersionOne或Jira进行用户故事的追 ...
- 客户端负载均衡Feign之三:Feign补充
在spring Cloud Netflix栈中,各个微服务都是以HTTP接口的形式暴露自身服务的,因此在调用远程服务时就必须使用HTTP客户端.我们可以使用JDK原生的URLConnection.Ap ...
- quicktime player录屏没有声音的解决方法
作者:殊哥链接:https://www.zhihu.com/question/20251726/answer/94938941来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出 ...
- Linux上面的MTU含义
问题场景描述: 最近在搞一个很菜的程序--FTP上传文件. 但是这个 很菜的程序搞的我脑袋疼了 半个月. 在linux上面部署了我的程序,上传文件在1KB以下顺利上传,但是1KB以上上传不上去. 程序 ...
- Android 按下home键,程序在后台运行,在设置中点击程序的启动时,会再次打开启动页的解决办法
在onCreate()方法中增加如下代码即可: if (!isTaskRoot()) { finish(); return; }
- FileMaker Server连接SQL Server测试
用FM测试了一把扫二维码.效果还不错,简单的设置几下就可以上线,使用Iphone扫二维码进行盘点以及更新照片功能.接下来测试下下ODBC连接. FMS连接SQL Server测试 1. 在FMS服务器 ...