zoukankan      html  css  js  c++  java
  • 微信开发-自定义菜单

    public static void createMenu(String token,String menuStr)throws ClientProtocolException, IOException
    	{
    		token = "你获取的access_token";
    		menuStr = "{"+
                    ""button":["+
                    "{"name":"xxx","+
                    ""type":"view"," +
                    ""url":"http://www.baidu.com"" +
                    "},"+
                    "{"name":"xxx","+
                    ""type":"view"," +
                    ""url":"http://www.qq.com"" +
                    "},"+
                    "{"name":"xxxx","+
                    ""type":"view"," +
                    ""url":"http://www.163.com"" +
                    "}"+
                "]"+
            "}";
    		
    		String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="+ token;
    
    		DefaultHttpClient httpClient = new DefaultHttpClient();
    		HttpPost post = new HttpPost(url);
    
    		post.setEntity(new StringEntity(menuStr, WxData.CharSet));
    		HttpResponse response = httpClient.execute(post);
    		String jsonStr = EntityUtils.toString(response.getEntity(),WxData.CharSet);
    		
    		System.out.println(jsonStr);
    	}
    菜单格式为json然后你Post给微信;它会帮你完成,一般修改之后会有3-10分钟延迟,或者取消关注之后再次关注等待刷新;
  • 相关阅读:
    货币
    沙漏
    秋季学习总结
    三个老师
    介绍自己
    redis 的部分配置
    第二次博客作业
    第一次阅读作业
    shell_通配符
    shell_/dev/null,>和&
  • 原文地址:https://www.cnblogs.com/MedivhQ/p/4101263.html
Copyright © 2011-2022 走看看