Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于获取(接收)用户发送消息 #19

Closed
zsj1029 opened this issue May 16, 2015 · 2 comments
Closed

关于获取(接收)用户发送消息 #19

zsj1029 opened this issue May 16, 2015 · 2 comments

Comments

@zsj1029
Copy link

zsj1029 commented May 16, 2015

$this->wxServer->on('message', function($message) {
return Message::make('text')->content('您好!');
});
如何获取用户发来的信息呢?
比如我记录用户的信息日志
根据信息查询订单数据返回,类似智能回复
$message 这个?
如何能更好的扩展智能回复方案

@zsj1029
Copy link
Author

zsj1029 commented May 16, 2015

貌似是的谢谢,输出了看了一下
把服务器所有信息都以json返回了
很好用的sdk,非常棒谢谢

@zsj1029 zsj1029 closed this as completed May 16, 2015
@overtrue
Copy link
Collaborator

@zsj1029 是的。用户发来的信息在 $message 里, 同理,事件也是一样,需要注意的是,这里的 $message 它本身是一个对象(Bag), 而不是一个简单的数组,这样做的目的是为了让你可以使用 $message-> FromUserName 或者 $message['FromUserName'] 都可以得到数据。

如果你想到得到干净的数组,可以:$message->toArray(); 或者想得到 json: $message->toJson()

如果在使用过程中遇到任何问题请再向我反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants