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分钟延迟,或者取消关注之后再次关注等待刷新;
  • 相关阅读:
    创意:网络族谱
    排列组合的要点
    创意:人生记录
    纽康悖论谜题
    发财的要点
    c#4.0协变逆变的理解
    关于开发自我训练课程
    反对继承
    远离疲倦,告别非理性思维
    中国软件正版化的理想模型
  • 原文地址:https://www.cnblogs.com/MedivhQ/p/4101263.html
Copyright © 2011-2022 走看看