Skip to content

文件File

HanSon edited this page Mar 16, 2017 · 1 revision

所有文件均下载至tmp/file文件夹中

属性

属性 类型 含义
msg array 消息的原始数组
title string 文件名

msg

Array
(
    [MsgId] => 5021213813999974957
    [FromUserName] => @@3c43be6466c35ca631fe7a7d4ca94abcbd68a944e0d2458f96324894d0ff8db6
    [ToUserName] => !
    [MsgType] => 49
    [Content] => @fda07bed000e979749caa42bdebd14385a91387264b13a894934ee5da2aa9299:<br/>&lt;?xml version="1.0"?&gt;<br/>&lt;msg&gt;<br/>        &lt;appmsg appid="wx6618f1cfc6c132f8" sdkver="0"&gt;<br/>               &lt;title&gt;contact.json&lt;/title&gt;<br/>            &lt;des /&gt;<br/>              &lt;action&gt;view&lt;/action&gt;<br/>          &lt;type&gt;6&lt;/type&gt;<br/>         &lt;showtype&gt;0&lt;/showtype&gt;<br/>         &lt;content /&gt;<br/>          &lt;url /&gt;<br/>             &lt;dataurl /&gt;<br/>           &lt;lowurl /&gt;<br/>           &lt;lowdataurl /&gt;<br/>               &lt;recorditem&gt;&lt;![CDATA[]]&gt;&lt;/recorditem&gt;<br/>   &lt;thumburl /&gt;<br/>          &lt;extinfo /&gt;<br/>          &lt;sourceusername /&gt;<br/>           &lt;sourcedisplayname /&gt;<br/>                &lt;commenturl /&gt;<br/>               &lt;appattach&gt;<br/>                  &lt;totallen&gt;537667&lt;/totallen&gt;<br/>                    &lt;attachid&gt;@cdn_30580201000451304f020100020491fc96c002033d14b9020497e503b70204588967b7042d3134383533393939383433383539326135313766316632336533306432336636396231303536643132303763650201000201000400_37383162336666666266646164303235_1&lt;/attachid&gt;<br/>                      &lt;emoticonmd5 /&gt;<br/>                      &lt;fileext&gt;json&lt;/fileext&gt;<br/>       &lt;cdnattachurl&gt;30580201000451304f020100020491fc96c002033d14b9020497e503b70204588967b7042d3134383533393939383433383539326135313766316632336533306432336636396231303536643132303763650201000201000400&lt;/cdnattachurl&gt;<br/>                       &lt;aeskey&gt;37383162336666666266646164303235&lt;/aeskey&gt;<br/>                     &lt;encryver&gt;1&lt;/encryver&gt;<br/>          &lt;/appattach&gt;<br/>         &lt;md5&gt;56d93c60b54474db8cb0c3bebf6005c2&lt;/md5&gt;<br/>    &lt;/appmsg&gt;<br/>   &lt;fromusername&gt;wxid_593u6xw30zum22&lt;/fromusername&gt;<br/>        &lt;scene&gt;0&lt;/scene&gt;<br/>       &lt;appinfo&gt;<br/>            &lt;version&gt;7&lt;/version&gt;<br/>           &lt;appname&gt;微信电脑版&lt;/appname&gt;<br/>  &lt;/appinfo&gt;<br/>   &lt;commenturl&gt;&lt;/commenturl&gt;<br/>&lt;/msg&gt;<br/><br/>
    [Status] => 3
    [ImgStatus] => 1
    [CreateTime] => 1485399991
    [VoiceLength] => 0
    [PlayLength] => 0
    [FileName] => contact.json
    [FileSize] => 537667
    [MediaId] => @crypt_e4dbe25f_f219c73625c9bf4231f5998403f244bbb6b77648715f39c959861420e9ae59eadec474788bab4828557db6a4b4e4004da30b56e81260b72416a2dc5c75a224a986732180a85bec4a82fa92c1815586b110984ac9a3ebcea11545ecdf0b4b5b493307db20b095c6cd1079077d998a4b51711d057ea1499a75d434fac6bd415cd0a1066694ae2290fd623f2429f99937da17a4e66c6986b24dba97caa789a008ea53792281c258684fce6336ac05fba819d2bd1e7ea5a40ce3814fb29449cf36d4a197d7487155e54493fbc2e30882bd301308c57619fb75945499094fbcd28c5e
    [Url] =>
    [AppMsgType] => 6
    [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] => wx6618f1cfc6c132f8
            [Type] => 0
        )

    [HasProductId] => 0
    [Ticket] =>
    [ImgHeight] => 0
    [ImgWidth] => 0
    [SubMsgType] => 0
    [NewMsgId] => 5021213813999974957
    [OriContent] =>
)

栗子

$robot->server->setMessageHandler(function ($message){
    // 发送收到的文件名
    if ($message instanceof File) {
        return '收到文件:' . $message->title;
    }
});
Clone this wiki locally