微信開發 二 微信選單建立

2021-07-25 22:36:42 字數 2178 閱讀 6267

在下面的介面除錯中可以立即看到建立的選單。特別需要注意的是選單的url裡面一定不能包含空格不然選單會一直建立不成功,本人就是因為這個問題花了半天的時間。

下面附上建立選單的**

public static void  createmenu(string type) throws unsupportedencodingexceptionelse

smsclientaccesstool tool = smsclientaccesstool.getinstance();

snippet.getaccesstoken();//獲取token

string token = (string)systeminit.weixinmap.get("weixintoken");

system.out.println(token);

list> button1 = new arraylist>();

list> button2_1 = new arraylist>();

list> button2_2 = new arraylist>();

list> button2_3 = new arraylist>();

mapmap1 = new hashmap();

map1.put("type","click");

map1.put("name", "選單一");

map1.put("key", "1_promanage");

mapmap11 = new hashmap();

map11.put("type","view");

map11.put("name", "選單11");

map12.put("name", "選單12");

map2.put("name", "選單二");

map2.put("key", "2_promanage");

mapmap21 = new hashmap();

map21.put("type","view");

map21.put("name", "選單22");

map21.put("url",url+"/service/activity_july.html?trackid=10023");

map2.put("sub_button",button2_2);

mapmap3 = new hashmap();

map3.put("type","click");

map3.put("name", "選單三");

map3.put("key", "3_promanage");

mapmap31 = new hashmap();

map31.put("type","view");

map31.put("name", "選單31");

}建立後的截圖

微信開發 設定選單

208.3.6 更新 我們不再使用josnhelp返回字典類或者強型別 而是直接返回動態型別,這樣就會方便的多。建立我們的選單api 這裡只寫了建立選單,還有查詢和刪除選單這裡沒有寫。跟這個差不多的,照著搬就好了。因為上篇我們設定了我們的伺服器url。在設定的url中寫 getaccesstoken...

微信選單修改

問題 1.把treegrid寫成了datagrid 2.get方式提交引數不能太長,不然後臺獲取不到完整的引數。3.ajax不可以直接返回html 4.treegrid資料格式類似json資料但是需要乙個id和parentid來識別父子關係。5.json轉物件的時候 看清楚資料格式再去選擇用json...

微信開發(二)自定義選單

概述 目前自定義選單最多包括3個一級選單,每個一級選單最多包含5個二級選單。一級選單最多4個漢字,二級選單最多7個漢字,多出來的部分將會以 代替。結果 步驟 1.呼叫介面獲得通訊token 2.呼叫介面建立自定義選單 3.響應自定義選單操作 實現 1.呼叫介面獲得通訊token 其次伺服器上建立ph...