From 76c3fe9bac61ae516f008159558495cc54615047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Thu, 20 Aug 2015 23:20:20 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20=E8=87=AA=E5=AE=9A=E4=B9=89=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 自定义菜单.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/自定义菜单.md b/自定义菜单.md index d8bcf09..18237de 100644 --- a/自定义菜单.md +++ b/自定义菜单.md @@ -24,15 +24,15 @@ use Overtrue\Wechat\MenuItem; $appId = 'wx3cf0f39249eb0e60'; $secret = 'f1c242f4f28f735d4687abb469072a29'; -$menu = new Menu($appId, $secret); +$menuService = new Menu($appId, $secret); ``` ## API -+ `array $menu->get();` 读取菜单 -+ `boolean $menu->set(array $menus);` 设置菜单,参数为一个包含最多三个一级菜单项的数组 -+ `boolean $menu->delete();` 删除菜单 ++ `array $menuService->get();` 读取菜单 ++ `boolean $menuService->set(array $menus);` 设置菜单,参数为一个包含最多三个一级菜单项的数组 ++ `boolean $menuService->delete();` 删除菜单 + `new MenuItem($name, $type = null, $key = null)` 创建一个菜单项 - `$name` 菜单项名称,比如:`今日歌曲` - `$type` 菜单项类型,比如:`view`,`click`等,更多请参考 http://mp.weixin.qq.com/wiki `自定义菜单` 章节。 @@ -60,7 +60,7 @@ $menus = array( ); try { - $menu->set($menus);// 请求微信服务器 + $menuService->set($menus);// 请求微信服务器 echo '设置成功!'; } catch (\Exception $e) { echo '设置失败:' . $e->getMessage(); @@ -168,7 +168,7 @@ class WechatController { $appId = 'wx3cf0f39249eb0e60'; $secret = 'f1c242f4f28f735d4687abb469072a29'; - $menu = new Menu($appId, $secret); + $menuService = new Menu($appId, $secret); $menus = Input::get('menus'); // menus 是你自己后台管理中心表单post过来的一个数组 @@ -192,7 +192,7 @@ class WechatController { $target[] = $item; } - $menu->set($target); // 失败会抛出异常 + $menuService->set($target); // 失败会抛出异常 return Redirect::back()->withMessage('菜单设置成功!'); }