/** * API - 创建/维护自定义菜单 * http://w.f-fusion.com/?method=create-menu&ver=1.0&time=1386582783&hash=930d61815f82eaf80781a2dc3187feb9 * http://127.0.0.1:120/?method=create-menu&ver=1.0&time=1386582783&hash=930d61815f82eaf80781a2dc3187feb9 */ private function apiCreateMenu() { $menuData = '{ "button": [ { "name": "大电商", "sub_button": [ { "type": "view", "name": "微电商", "url" : "http://m.f-fusion.com/wechat/weidianshang" }, { "type": "view", "name": "独立电商", "url" : "http://m.f-fusion.com/wechat/dulishangcheng" }, { "type": "view", "name": "进销存管理", "url" : "http://m.f-fusion.com/wechat/jinxiaocun" } ] }, { "name": "整合营销", "sub_button": [ { "type": "view", "name": "品牌整合", "url" : "http://m.f-fusion.com/wechat/pinpaizhenghe" }, { "type": "view", "name": "渠道整合", "url" : "http://m.f-fusion.com/wechat/qudaozhenghe" } ] }, { "name": "关注熔意", "sub_button": [ { "type": "view", "name": "品牌进化论", "url" : "http://m.f-fusion.com/wechat/jinhualun" }, { "type": "view", "name": "合作共赢", "url" : "http://m.f-fusion.com/wechat/hezuo" }, { "type": "view", "name": "联系我们", "url" : "http://m.f-fusion.com/wechat/contact" } ] } ] }'; $url = self::WX_API_SERVICE_URL . 'menu/create?access_token=' . self::$wx_last_token_string; $result = Curl::post($url, null, $menuData, 3); if ($result === false) { echo 'REQUEST FAILED!'; } else { $resp = json_decode($result['result'], true); dump($resp); } }
/** * API - 创建/维护自定义菜单 * http://w.f-fusion.com/?method=create-menu&ver=1.0&time=1386582783&hash=930d61815f82eaf80781a2dc3187feb9 * http://127.0.0.1:120/?method=create-menu&ver=1.0&time=1386582783&hash=930d61815f82eaf80781a2dc3187feb9 */ private function apiCreateMenu() { /* $menuData = '{ "button": [ { "type": "view", "name": "在线调查", "url" : "http://m.f-fusion.com/wechat/vote" } ] }'; */ $menuData = array(); $menuData['button'] = array(); $menuButton = array(); $menuButton['name'] = '在线调查'; $menuButton['type'] = 'view'; $menuButton['url'] = $this->JANUSKING_WECHAT['DOMAIN_PREFIX'] . 'wechat/vote'; $menuData['button'][] = $menuButton; $menuDataString = stripslashes(json_encode($menuData, JSON_UNESCAPED_UNICODE)); $url = self::WX_API_SERVICE_URL . 'menu/create?access_token=' . self::$wx_last_token_string; $result = Curl::post($url, null, $menuDataString, 5); if ($result === false) { echo 'REQUEST FAILED!'; } else { $resp = json_decode($result['result'], true); dump($resp); } }