我可以使用下面的 CURL 请求通过 Firebase Messaging 发送通知。我当前正在使用 OAuth 2.0 Playground 来获取访问令牌。我需要实现一个 PHP 脚本来执行此操作。如何在 PHP 中以编程方式生成访问令牌?
curl -X POST -k -H 'Authorization: Bearer access_token_goes_here' -H 'Content-Type: application/json' -i 'https://fcm.googleapis.com/v1/projects/projectId/messages:send' --data '{
"message":{
"topic" : "newTopic",
"notification" : {
"body" : "This is a Firebase Cloud Messaging Topic Message!",
"title" : "FCM Message"
}
}
} Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号