EaseBaidu
  • 概述
  • 开始
    • 安装
  • 熊掌号
    • 入门
    • 服务端
    • 网页授权
    • 消息
    • 消息群发
    • 模板消息
    • 用户
    • 用户标签
    • 菜单管理
    • 主页管理
    • 数据统计
    • 素材管理
    • 临时素材
    • 客服消息
    • JSSDK
  • 熊掌号TP
    • 入门
    • 服务端
    • 代授权
  • 智能小程序
    • 入门
    • 消息模板
    • 消息解密
    • 熊掌号登录
  • 智能小程序TP
    • 入门
    • 代授权
    • 小程序登录
    • 基础信息
    • 图片上传
    • 服务器
    • 包管理
Powered by GitBook
On this page
  • 基本使用
  • 注册多个消息处理器

Was this helpful?

  1. 熊掌号

服务端

基本使用

设置消息处理器:

$bear->server->push(function ($message) {
    switch ($message['MsgType']) {
        case 'event':
            return '收到事件消息';
            break;
        case 'text':
            return '收到文字消息';
            break;
        default:
            return '收到其它消息';
            break;
    }
    
    // TODO...
})

$response = $bear->server->serve();
$response->send();

获取$message参数:

$message = $server->getMessage();

注册多个消息处理器

注册多个 handler:

$app->server->push(OtherHandler::class);
$app->server->push(...);
Previous入门Next网页授权

Last updated 6 years ago

Was this helpful?