频道栏目
首页 > 资讯 > 微信公众平台开发 > 正文

微信企业号生成菜单栏

16-07-01        来源:[db:作者]  
收藏   我要投稿
一、
 
二、
 
三、
 
四、
 
五、
 
六、
七、
八、
九、
header("Content-type: text/html; charset=utf-8");
define("ACCESS_TOKEN", 'wx2PjXrVLMOlOAPiWt3solXPe_vC69UTzY2IbpNqgFR_dQ_pEJ_3x3o46tfEtnLm');
function weixinPost($data){
        $ch = curl_init(); //初始化
        //设置参数
         curl_setopt($ch, CURLOPT_URL, "https://qyapi.weixin.qq.com/cgi-bin/menu/create?access_token=".ACCESS_TOKEN."&agentid=4");//设施url参数
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");//设置请求method参数
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //传值
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         $tmpInfo = curl_exec($ch);//执行

         if (curl_errno($ch)) {//如果错误,输出一下
          return curl_error($ch);
         }
         curl_close($ch);//关闭
         return $tmpInfo;
    }
    
$data = '{
    "button": [
        {
            "name": "说说",
            "sub_button": [
                {
                    "type": "view",
                    "name": "搞笑说说",
                    "url":"http://www.soso.com/"
                },
                {
                    "type": "view",
                    "name": "爱情说说",
                    "url":"http://www.soso.com/"
                },
                {
                    "type": "view",
                    "name": "职场说说",
                    "url":"http://www.soso.com/"
                },
                {
                    "type": "view",
                    "name": "励志说说",
                    "url":"http://www.soso.com/"
                },
                {
                    "type": "view",
                    "name": "心情说说",
                    "url":"http://www.soso.com/"
                }
            ]
        },
        {
            "name": "文章",
            "sub_button": [
                {
                    "type": "view",
                    "name": "健身文章",
                    "url":"http://www.baidu.com/"
                 },
                {
                    "type": "view",
                    "name": "养生文章",
                    "url":"http://www.baidu.com/"
                },
                {
                    "type": "view",
                    "name": "互联网文章",
                    "url":"http://www.baidu.com/"
                },
                {
                    "type": "view",
                    "name": "教育文章",
                    "url":"http://www.baidu.com/"
                },
                {
                    "type": "view",
                    "name": "法律文章",
                    "url":"http://www.baidu.com/"
                }
            ]
        },{
            "name": "心情说",
            "sub_button": [
                {
                    "type": "view",
                    "name": "首页",
                    "url":"http://www.baidu.com/"
                 },
                {
                    "type": "view",
                    "name": "关于我们",
                    "url":"http://www.baidu.com/"
                }
            ]
        }
    ]
}';
    $tmpInfo = weixinPost($data);  
    echo $tmpInfo;
?>
 
相关TAG标签
上一篇:微信web调试工具
下一篇:php判断用户客户端是否是微信内置客户端
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站