尝试使用“to”而不是“registration_ids”
这是邮递员历史记录中保存的身体数据[我不记得它是否有效]:
{ "data": {
"score": "5x1",
"time": "15:10" }, "to" : "token_id"}
检查这个脚本:如果你想做主题消息传递
$url = "https://fcm.googleapis.com/fcm/send";
$topic = "topic_name";
$fields = array(
"to" => "/topics/".$topic,
"data" => $message,
"time_to_live" => 30,
"delay_while_idle" => true
);
$auth_key = "auth_key";
$headers = array(
"Authorization: key=".$auth_key,
"Content-Type: application/json"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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);
希望有帮助