### receiver.php 开发升级步骤
#### 步骤 1:
0.6 订阅机制发生了变化, **$this->message** 结构可以参阅文段代码.
|| 示例
以下示例为用户模拟图片消息, PicTran 默认订阅图片消息.
~~~
defined('IN_IA') or exit('Access Denied');
class PicTranModuleReceiver extends WeModuleReceiver {
public function receive() {
$type = $this->message['type'];
//这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看微擎文档来编写你的代码
$c = '';
foreach ($this->message as $key => $value) {
$c .= "$key : $value \r\n";
}
file_put_contents('e:\\receive.txt', $c);
}
}
~~~
|| 执行结果
当操作员对某公众号进行后台管理操作时, 将会执行消息订阅, 文件输出结果为:
~~~
from : fromUser
to : toUser
time : 1413941559
type : image
event :
tousername : toUser
fromusername : fromUser
createtime : 1413941559
msgtype : image
picurl : http://www.baidu.com/img/bdlogo.gif
msgid : 1234567890123456
url : http://www.baidu.com/img/bdlogo.gif
~~~