📜  php apns 通知源代码 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:48.736000             🧑  作者: Mango

代码示例1
";
        exit;
        } else {
        echo "Successfully connected to the APNS. Processing...
"; } $messageBody['aps'] = array('alert' => $message, 'sound' => 'default', 'badge' => 2, ); $payload = json_encode($messageBody); $notification = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload; $wroteSuccessfully = fwrite($connection, $notification, strlen($notification)); if (!$wroteSuccessfully){ echo "Could not send the message
"; } else { echo "Successfully sent the message
"; } fclose($connection); ?>