脚本宝典收集整理的这篇文章主要介绍了php – 在MySQL数据库中发生更新后立即向android发送通知,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
如果您对FCM一无所知,请访问:https://firebase.google.com/docs/cloud-messaging/concept-options
function senDFCMPushnotification($arr) { $device_token = $arr['device_token']; $message = $arr['message']; $url = 'https://fcm.GOOGLEapis.COM/fcm/send'; $fields = array ( 'registration_ids' => array ( $device_token ),'data' => array ( "message" => $message,"sound" => "default" ),'notification' => array( 'body' => $message,'tITle' => 'PRojectName',) ); $fields = json_encode ( $fields ); $headers = array ( 'Authorization: key=' . "PUT_YOUR_FCM_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,CURLOPT_POSTFIELDS,$fields ); $result = curl_exec ( $ch ); var_dump($result); curl_close ( $ch ); } $arr = [ 'device_token' => "PLACE_YOUR_DEVICE_TOKEN",'message' => 'PLACE_YOUR_MESSAGE',]; sendFCMPushnotification($arr);
以上是脚本宝典为你收集整理的php – 在MySQL数据库中发生更新后立即向android发送通知全部内容,希望文章能够帮你解决php – 在MySQL数据库中发生更新后立即向android发送通知所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。