可能文档不太清晰,这里做一个补充~,直接上代码
如果你是发送的网络图片,也就是http的图片,代码如下,msg必须有name和url
下面代码是laravel框架写法,url为http开头的图片地址
return [
"event" => 'SendImageMsg',
"robot_wxid" => $request['robot_wxid'],
"to_wxid" => $to_wxid,
"member_wxid" => '',
"member_name" => '',
"group_wxid" => '',
"msg" => [
'name'=>"{$qr['server_time']}.png",
'url'=>env('APP_URL') . "/storage/images/{$qr['server_time']}.png"
],
];
如果你发的图片是你本机图片(和可爱猫挂机机器同一台),代码如下,msg必须含有name和path
下面代码是laravel框架写法,path为你本机的完整路径且有读写权限,例如 D:/a/v.jpg,如果发不出,可能路径需要转义,比如把“/”改为“//”
return [
"event" => 'SendImageMsg',
"robot_wxid" => $request['robot_wxid'],
"to_wxid" => $to_wxid,
"member_wxid" => '',
"member_name" => '',
"group_wxid" => '',
"msg" => [
'name'=>"{$qr['server_time']}.png",
'path'=>public_path("storage/images/{$qr['server_time']}.png")
],
];