/**微信生成菜单

* [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微信公共号自定义菜单。的更多相关文章

  1. C#微信公众号——自定义菜单

    自定义菜单最多包括3个一级菜单,每个一级菜单最多包含5个二级菜单.一级菜单最多4个汉字,二级菜单最多7个汉字,多出来的部分将会以“...”代替.自定义菜单的介绍,可以看官方开发文档http://mp. ...

  2. 微信公众号自定义菜单中添加emoji表情

    做微信公众号开发,可能会遇到如何加入emoji表情的问题.今天在“海南旅游小管家”公众号的菜单中加入了emoji表情,特此记录备忘. 1.登录微信公众号,在左侧找到[开发者工具]菜单,点击进入,找到[ ...

  3. vue 仿写微信公众号自定义菜单

    先看效果图 代码参考 <template> <div> <!-- 公众号设置 --> <el-col :span="24" style=& ...

  4. .net mvc 微信公众号 自定义菜单

    官方文档:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN ...

  5. 通过微信公众号API复制公众号自定义菜单同时增加子菜单方法

    主要的原因是再不破坏公众号以前的菜单的基础上增加自定义菜单,主要步骤如下: 1.通过微信提供的微信公众平台接口调试工具获取公众号的所有自定义菜单 网址:https://mp.weixin.qq.com ...

  6. 微信公共号url地址出错,调用上次设置地址.

    开发微信公共号时总是会遇到要修改公共号里自定义菜单的地址,修改过后有些手机会重新请求错误(上次)的地址. 针对这个问题,我采用重新关注公共号.清楚公共号内容.清楚浏览器缓存的方式,前两种均不得解决,第 ...

  7. 微信公众平台自定义菜单新增扫一扫、发图片、发位置 LBS运作更便捷

    今天微信公众平台发布更新,自定义菜单新增扫一扫.发图片.发送位置等功能,这对于有意挖掘微信LBS服务的运营者来说更便捷了,订阅号不用返回微信界面就能扫图.发送图片.调用地理位置,用户体验更友好,自然也 ...

  8. 微信公众平台自定义菜单PHP开发

    微信公众平台自定义菜单PHP开发,微信公众平台自定义菜单是如何实现的呢?其实很简单,首先在微信公众平台升级为服务号,获取appid和appsecret,然后根据这2个参数获取access_token, ...

  9. 微信公众平台自定义菜单及高级接口PHP SDK(转)

    本文介绍介绍微信公众平台自定义菜单及高级接口的PHP SDK及使用方法. 作者 方倍工作室 修正记录: 2014.05.03 v1.0 方倍工作室 http://www.cnblogs.com/txw ...

随机推荐

  1. html多个水平并列组件自适应等高的做法

    做一个div盒子,设置over-flow:hidden,设置高度为auto.然后再盒子里排列若干inline-block,inline元素. 自适应的话常用做法是用line-height,font-s ...

  2. 黄聪:VS2017调试时提示“运行时无法计算表达式的值”

    具体操作: 工具-选项-调试-常规,选中“使用托管兼容模式”,问题解决

  3. Hadoop概念学习系列之谈hadoop/spark里为什么都有,键值对呢?(四十)

    很少有人会这样来自问自己?只知道,以键值对的形式处理数据并输出结果,而没有解释为什么要以键值对的形式进行. 包括hadoop的mapreduce里的键值对,spark里的rdd里的map等. 这是为什 ...

  4. 峰Redis学习(3)Redis 数据结构(字符串、哈希)

    第一节:Redis 数据类型介绍 五种数据类型: 字符串(String) 字符串列表(list) 有序字符串集合(sorted set) 哈希(hash) 字符串集合(set)   第二节:Redis ...

  5. Scrapy学习篇(八)之settings

    Scrapy设定(settings)提供了定制Scrapy组件的方法.你可以控制包括核心(core),插件(extension),pipeline及spider组件.设定为代码提供了提取以key-va ...

  6. Hadoop+Hbas完全分布式安装部署

    Hadoop安装部署基本步骤: 1.安装jdk,配置环境变量. jdk可以去网上自行下载,环境变量如下: 编辑  vim  /etc/profile 文件,添加如下内容: export JAVA_HO ...

  7. ssh 免密码登录linux

    就两步,take it easy! step1. 在A-PC生成公钥和密钥对 ssh-keygen -t rsa step2. 将A-PC公钥上传至B-PC ssh-copy-id abby@.xxx ...

  8. SpringMVC之HandlerAdapter解析

    HandlerAdapter字面上的意思就是处理适配器,它的作用用一句话概括就是调用具体的方法对用户发来的请求来进行处理.当handlerMapping获取到执行请求的controller时,Disp ...

  9. 知识点:Mysql 基本用法之事务

    事务 事务用于将某些操作的多个SQL作为原子性操作,一旦有某一个出现错误,即可回滚到原来的状态,从而保证数据库数据完整性. 事务实例: create table user( id int primar ...

  10. 阿里云:游戏行业DDoS攻击解决方案

    转自:http://www.gamelook.com.cn/2018/01/319420 根据全球游戏和全球移动互联网行业第三方分析机构Newzoo的数据显示:2017年上半年,中国以275亿美元的游 ...