我可以使用php中的GCM推送插件一次向多个设备发送多条消息吗 如何一次向多个设备发送多条消息
我已经编辑了我的代码,请使用此我可以使用php中的GCM推送插件一次向多个设备发送多条消息吗 如何一次向多个设备发送多条消息,php,android,cordova,push-notification,google-cloud-messaging,Php,Android,Cordova,Push Notification,Google Cloud Messaging,我已经编辑了我的代码,请使用此 <?php include_once './GCM.php'; $regid = $_POST['regid'];//your registration id array $fields1=$_POST['message'];//your message array $total_message = count($fields1);//count total no of message $total_records = count($regid);//
<?php
include_once './GCM.php';
$regid = $_POST['regid'];//your registration id array
$fields1=$_POST['message'];//your message array
$total_message = count($fields1);//count total no of message
$total_records = count($regid);//Count total number of registration id
for($j=0;$j< $total_message;$j++)//loop for sending multiple messgae
{
for($i=0;$i< $total_records;$i++)//loop for sending to multiple device
{
$registatoin_ids = array($regid[$i]);
$message = array("price" => $total_message[$j]);
$result = $gcm->send_notification($registatoin_ids, $message);
}
}
?>
感谢您的友好回复。。但是我不想向多个设备发送一条消息这里我想向gcm服务器发送一个请求就向多个设备发送多条消息。。如果有什么办法可以做到这一点,请帮助我
<?php
include_once './GCM.php';
$regid = $_POST['regid'];//your registration id array
$fields1=$_POST['message'];//your message array
$total_message = count($fields1);//count total no of message
$total_records = count($regid);//Count total number of registration id
for($j=0;$j< $total_message;$j++)//loop for sending multiple messgae
{
for($i=0;$i< $total_records;$i++)//loop for sending to multiple device
{
$registatoin_ids = array($regid[$i]);
$message = array("price" => $total_message[$j]);
$result = $gcm->send_notification($registatoin_ids, $message);
}
}
?>