Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以使用php中的GCM推送插件一次向多个设备发送多条消息吗 如何一次向多个设备发送多条消息_Php_Android_Cordova_Push Notification_Google Cloud Messaging - Fatal编程技术网

我可以使用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);
}
}
?>