早上好,我有这段代码显示发送 Firebase 的通知,如果我收到消息,该代码是功能性的,并且是 Android 的一面,但我想在 Firebird 控制台中添加该消息 cUrl php apararezca,以了解如何很多人看到了
public function firebase(){
$apiKey = "awudaw:adwdawfag-xxxxxxxx";
$data = array('body'=>'Hola a todos tercero','title'=>'Tiene un nuevo mensaje global tercero');
$fields = array("to"=>"/topics/tipi",'notification'=>$data);
$headers = array('Authorization: key='.$apiKey,'Content-Type: application/json');
$url = 'https://fcm.googleapis.com/fcm/send';
$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);
curl_close($ch);
return json_decode($result,true);
}
www说