/
* 订单提醒
*/
public function sendOrderNotice(){
//请求地址
$uri = “http://goeasy.io/goeasy/publish”;
// 参数数组
$data = [
‘appkey’ => “你的APPkey”,
‘channel’ => “demo”,
‘content’ =>”您有新的订单”
];
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $uri );//地址
curl_setopt ( $ch, CURLOPT_POST, 1 );//请求方式为post
curl_setopt ( $ch, CURLOPT_HEADER, 0 );//不打印header信息
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );//返回结果转成字符串
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );//post传输的数据。
$return = curl_exec ( $ch );
curl_close ( $ch );
print_r($return);
}
PHP发送消息提醒
成功则返回:


var goeasy = new GoEasy({
appkey: ‘你的appkey’
});
goeasy.subscribe({
channel: ‘demo’,
onMessage: function(message){
alert(‘Receive:’+message.content);
}
});

JS接受消息

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/225134.html原文链接:https://javaforall.net
