From 68f1ee5ec127fbac3642d232e078270a777c2d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Fri, 13 Mar 2015 11:19:50 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20=E7=9B=91=E5=90=AC=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 监听微信事件.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/监听微信事件.md b/监听微信事件.md index 8ad9eb0..30fff62 100644 --- a/监听微信事件.md +++ b/监听微信事件.md @@ -1,5 +1,5 @@ 所有的事件都可以很方便的监听与处理,与监听消息一样,同样支持监听全部类型或者指定类型。 -关于事件类型请参考微信官方文档:http://mp.weixin.qq.com/wiki/2/5baf56ce4947d35003b86a9805634b1e.html + ```php $wechat->on('event', callable $callback); @@ -10,7 +10,16 @@ $wechat->on('event', string $eventType, callable $callback); 参数说明 - `$eventType` string, 指定要处理的消息类型,ex:`image` -- `$callback` callable, 回调函数,closure匿名函数,或者一切可调用的方法或者函数 +- `$callback` callable, 回调函数,Closure 匿名函数,或者一切可调用的方法或者函数 + +`$callback` 接收一个参数 `$event` , `$event` 包含以下基本属性: + + ToUserName 接收者 ID(公众号 ID) + FromUserName 发送方帐号(一个 OpenID) + CreateTime 消息创建时间 (整型) + MsgType event + Event 事件类型,ex: subscribe + EventKey 事件 Key 值,与自定义菜单接口中 Key 值对应 example: @@ -35,3 +44,5 @@ $result = $wechat->serve(); echo $result; ``` + +关于事件类型请参考微信官方文档:http://mp.weixin.qq.com/wiki/2/5baf56ce4947d35003b86a9805634b1e.html \ No newline at end of file