我正在使用F curl通过FCM向我的android用户发送推送通知,如下代码。我的用户名,令牌等存储在数据库中。我将令牌存储在数组中,并通过1000个大块发送。
$regIdChunk=array_chunk($token,1000);
foreach($regIdChunk as $RegId){
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array(
'registration_ids' => $RegId,
'data' => $message
);
$fields = json_encode ( $fields );
$headers = array (
'Authorization: key=' . "MY_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, true );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $fields );
$result = curl_exec ( $ch );
我的消息数组如下
$message = array();
$message['data']['title'] =TITLE;
$message['data']['message'] =BODY;
现在我的查询是:是否有可能以某种方式从数据库中为每个令牌承载发送个性化消息BODY(例如包含用户名等的个人消息)?