本文整理汇总了PHP中GCM::sendPushNotificationToGCM方法的典型用法代码示例。如果您正苦于以下问题:PHP GCM::sendPushNotificationToGCM方法的具体用法?PHP GCM::sendPushNotificationToGCM怎么用?PHP GCM::sendPushNotificationToGCM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GCM
的用法示例。
在下文中一共展示了GCM::sendPushNotificationToGCM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$query_params = array(':cc' => $_POST['hotel_id']);
try {
$stmt = $db->prepare($query);
$result = $stmt->execute($query_params);
} catch (PDOException $ex) {
$response["success"] = 0;
$response["message"] = "Server failure please try again...";
die(json_encode($response));
}
$row = $stmt->fetch();
if ($row) {
$hotel_name = $row['hotel_name'];
}
//time to send the notification now
$pword = 99;
$time = $_POST['timeto'];
$notification = $_POST['message'];
$meal_name = $_POST['meal_name'];
$gcmRegIds = array($gcmRegs);
$message = array("message" => $notification, "meal_name" => $meal_name, "customer" => $hotel_name, "pword" => $pword, "timeto" => $time);
$send = $gcm->sendPushNotificationToGCM($gcmRegIds, $message);
if ($send) {
$response["success"] = 1;
$response["message"] = "Send successfully...";
echo json_encode($response);
} else {
$response["success"] = 0;
$response["message"] = "Server failure... error in sending, please try again";
echo json_encode($response);
}
}