• 微信查询菜单


    使用接口创建自定义菜单后,开发者还可使用接口查询自定义菜单的结构。
      查询菜单的接口如下:

    $url = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=".$access_token;
    $result = https_request($url);
    var_dump($result);
    
    function https_request($url, $data = null)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
        if (!empty($data)){
            curl_setopt($curl, CURLOPT_POST, 1);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        }
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($curl);
        curl_close($curl);
        return $output;
    }

    正确时的返回JSON数据包如下:

    {
        "menu":{
            "button":[
                {
                    "name":"扫码",
                    "sub_button":[
                        {
                            "type":"scancode_waitmsg",
                            "name":"扫码带提示",
                            "key":"rselfmenu_0_0",
                            "sub_button":[
    
                            ]
                        },
                        {
                            "type":"scancode_push",
                            "name":"扫码推事件",
                            "key":"rselfmenu_0_1",
                            "sub_button":[
    
                            ]
                        }
                    ]
                },
                {
                    "name":"发图",
                    "sub_button":[
                        {
                            "type":"pic_sysphoto",
                            "name":"系统拍照发图",
                            "key":"rselfmenu_1_0",
                            "sub_button":[
    
                            ]
                        },
                        {
                            "type":"pic_photo_or_album",
                            "name":"拍照或者相册发图",
                            "key":"rselfmenu_1_1",
                            "sub_button":[
    
                            ]
                        },
                        {
                            "type":"pic_weixin",
                            "name":"微信相册发图",
                            "key":"rselfmenu_1_2",
                            "sub_button":[
    
                            ]
                        }
                    ]
                },
                {
                    "name":"其他",
                    "sub_button":[
                        {
                            "type":"location_select",
                            "name":"发送位置",
                            "key":"rselfmenu_2_0",
                            "sub_button":[
    
                            ]
                        },
                        {
                            "type":"click",
                            "name":"今日歌曲",
                            "key":"V1001_TODAY_MUSIC",
                            "sub_button":[
    
                            ]
                        },
                        {
                            "type":"view",
                            "name":"搜索",
                            "url":"http://www.soso.com/",
                            "sub_button":[
    
                            ]
                        }
                    ]
                }
            ]
        }
    }
  • 相关阅读:
    Android,资料分享(2015 版)
    Http请求与响应
    SpringMVC + Spring 3.2.14 + Hibernate 3.6.10 集成详解
    ORA-14402: 更新分区关键字列将导致分区的更改
    Android Service的生命周期
    Android Service基础
    Android Intent 基本使用及对象构成
    Sublime Text3 个人使用心得
    深入了解line-height
    overflow之锚点技术实现选项卡
  • 原文地址:https://www.cnblogs.com/objects/p/7146003.html
Copyright © 2020-2023  润新知