更新时间:2022-06-10 22:15:29
有两个问题:
notification
部分,而不是 data
最后,我使用 PHP 函数 shell_exec()
通过 SSH 执行 cURL 请求.这并不理想,但它完成了工作.
In the end I used the PHP function shell_exec()
to do a cURL request over SSH instead. This isn't ideal but it got the job done.
示例代码:
shell_exec('curl -X POST --header "Authorization: key=<key here>" --header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{"to":"'.$to.'","priority":"high","notification":{"body": "'.stripslashes($message).'"}}"');