function definedItem(){ header("Content-type:text/html;charset=utf-8"); $appid="wx05d9393305accd18"; $appsecret="574949930358aeec6ead7e58abfb1522"; $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$appsecret; $res=$this->http_curl($url,'get','json'); echo $access_token=$res['access_token']; $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token='.$access_token; $postArr=array( 'button'=>array( array( 'name'=>urlencode('菜單一'), 'type'=>'click', 'key'=>'item1', ), array( 'name'=>urlencode('菜單二'), 'type'=>'click', 'key'=>'item1', ), array( 'name'=>urlencode('菜單二'), 'type'=>'click', 'key'=>'item1', ),? ), ); echo '<hr />'; var_dump($postArr); echo '<hr />'; echo $postJson=urldecode(json_encode($postArr)); $res = $this->http_curl($url,'post','json',$postJson); var_dump($res); }這段代碼這么讓他調(diào)用啊
1 回答
已采納

慕田峪3555374
TA貢獻137條經(jīng)驗 獲得超18個贊
直接調(diào)用這個方法就可以了啊,只要調(diào)一次就可以生成菜單了,以后除非有更改了再調(diào)重新生成新的菜單
- 1 回答
- 0 關(guān)注
- 1300 瀏覽
添加回答
舉報
0/150
提交
取消