我想使用以下代码发送带有图像的通知,但仍然无法正常工作
{
$msg = array
(
'body' => 'here is a message. message',
'title' => 'This is a title',
'subtitle' => 'This is a subtitle. subtitle',
'vibrate' => 1,
'sound' => 1,
'icon' => 'url_image',
'image' => 'url_image'
);
$fields = array
(
'registration_ids' => array('id1','id2'),
'notification' => $msg,
);
$headers = array
(
'Authorization: key=my_serverkey',
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'url of fcm ' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
}
我收到没有图像的通知
有什么解决方案?