Php 在云消息选项卡中找不到lagacy服务器密钥?
我正在尝试生成推送通知以响应本机android应用程序 我提到 我使用下面的代码通过php生成推送通知。并得到下面提到的错误 我在云消息选项卡中找不到lagacy服务器密钥,所以我在代码中放置了服务器密钥而不是lagacy服务器密钥。 也无法理解传递给类型的内容。 我现在如何解决它Php 在云消息选项卡中找不到lagacy服务器密钥?,php,firebase,curl,firebase-authentication,firebase-cloud-messaging,Php,Firebase,Curl,Firebase Authentication,Firebase Cloud Messaging,我正在尝试生成推送通知以响应本机android应用程序 我提到 我使用下面的代码通过php生成推送通知。并得到下面提到的错误 我在云消息选项卡中找不到lagacy服务器密钥,所以我在代码中放置了服务器密钥而不是lagacy服务器密钥。 也无法理解传递给类型的内容。 我现在如何解决它 public function fcm(){ define( 'API_ACCESS_KEY', ''); $registrationIds = array('db7z_kIQRgyk
public function fcm(){
define( 'API_ACCESS_KEY', '');
$registrationIds = array('db7z_kIQRgyktn...-a4LW:APA91bEtK_.....');
$msg = array
(
'title' => "Test",
'body' => "testing",
'summaryText' => 'The internet is built on cat pictures',
'click_action' => 'FCM_PLUGIN_ACTIVITY',
'vibrate' => 1,
'sound' => 1,
'type' => $this->type
);
$fields = array
(
'registration_ids' => $registrationIds,
'notification' => $msg
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
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 );
echo $result;
}
错误
{
"multicast_id": 1006474377365535027,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "MismatchSenderId"
}
]
}