简体   繁体   English

从php服务器向iOS设备发送多个推送通知

[英]Send Multiple push notification from php server to ios Devices

i am working on a app where there is need to send bulk push notification from the Php server to ios devices . 我正在开发需要将大量推送通知从Php服务器发送到ios设备的应用程序。 Is there any way to send multiple push notification from Php server to all devices without using any Loop. 有什么方法可以在不使用任何循环的情况下从Php服务器向所有设备发送多个推送通知。 *because this loop process reduce response time to client from the server *因为此循环过程减少了服务器对客户端的响应时间

If you are using ApnsPHP , then there is a way. 如果您使用的是ApnsPHP ,那么有一种方法。 This code is from his sample_push_many.php file. 这段代码来自他的sample_push_many.php文件。 First you have to add all the recepients 首先,您必须添加所有接收者

$push->connect();
for ($i = 1; $i <= 10; $i++) {
    $message = new ApnsPHP_Message($i == 5 ? INVALID_TOKEN : VALID_TOKEN);
    $message->setCustomIdentifier(sprintf("Message-Badge-%03d", $i));
    $message->setBadge($i);
    $push->add($message);
}
$push->send();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM