$headers = array (
'Authorization: key=' . 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
在页面刷新时,它会发送信息,但在每次刷新时都会发送信息 2次,3次,4次,..... 我尝试添加“Cache-Control:no-cache”,但它没有用。