Skip to content

图片Image

HanSon edited this page Mar 16, 2017 · 1 revision

属性

属性 类型 含义
msg array 消息的原始数组

msg

Array
(
    [MsgId] => 2517238668410556338
    [FromUserName] => @2aefd23a286785769c6be1cd61d53efc
    [ToUserName] => @2aefd23a286785769c6be1cd61d53efc
    [MsgType] => 3
    [Content] => <?xml version="1.0"?>
<msg>
        <img aeskey="7a9800ca513d46ae9fda0342ecbbcaa6" encryver="1" cdnthumbaeskey="7a9800ca513d46ae9fda0342ecbbcaa6" cdnthumburl="3050020100044930470201000204aa9e03a402033d14b90204d9fd03b70204587dd1a90425617570696d675f336335386463623463303432313065325f313438343634303638353036310201000201000400" cdnthumblength="14200" cdnthumbheight="120" cdnthumbwidth="91" cdnmidheight="0" cdnmidwidth="0" cdnhdheight="0" cdnhdwidth="0" cdnmidimgurl="3050020100044930470201000204aa9e03a402033d14b90204d9fd03b70204587dd1a90425617570696d675f336335386463623463303432313065325f313438343634303638353036310201000201000400" length="123697" md5="e691721a61fe5cbbbfe5173d50262623" />
</msg>

    [Status] => 3
    [ImgStatus] => 2
    [CreateTime] => 1484640682
    [VoiceLength] => 0
    [PlayLength] => 0
    [FileName] =>
    [FileSize] =>
    [MediaId] =>
    [Url] =>
    [AppMsgType] => 0
    [StatusNotifyCode] => 0
    [StatusNotifyUserName] =>
    [RecommendInfo] => Array
        (
            [UserName] =>
            [NickName] =>
            [QQNum] => 0
            [Province] =>
            [City] =>
            [Content] =>
            [Signature] =>
            [Alias] =>
            [Scene] => 0
            [VerifyFlag] => 0
            [AttrStatus] => 0
            [Sex] => 0
            [Ticket] =>
            [OpCode] => 0
        )

    [ForwardFlag] => 0
    [AppInfo] => Array
        (
            [AppID] =>
            [Type] => 0
        )

    [HasProductId] => 0
    [Ticket] =>
    [ImgHeight] => 120
    [ImgWidth] => 91
    [SubMsgType] => 0
    [NewMsgId] => 2517238668410556338
    [OriContent] =>
)

方法

Image::send($username, $image); 发送图片消息, $image为图片路径 Image::sendByMsgId($username, $msgId); 发送某消息id的图片

栗子

$robot->server->setMessageHandler(function ($message){
    // 发送收到的图片
    if ($message instanceof Image) {
        return $message;
    }
});
Clone this wiki locally