极光推送:
拿取自己注册的AppKey 和 Master Secret
其次看文档
代码描述:
/**组装需要的参数
$receive = 'all';//全部
$receive = array('tag'=>array('###','###','###'));//标签
$receive = array('alias'=>array('fdsfd3453543435435453*****88497f501'));//别名
$content = '这是一个测试的推送数据....测试....Hello World...';
$m_type = 'http';
$m_txt = 'http://www.iqujing.com/';
**/
//极光推送
public static function sendPush()
{
$m_type = 'http';//推送附加字段的类型
$m_txt = 'http://www.groex.cn/';//推送附加字段的类型对应的内容(可不填) 可能是url,可能是一段文字。
$m_time = 86400;//离线保留时间
$platform = 'all';
$receive = "all"; // ["alias" => [ "123" ]]; 可以是别名 也可以registration_id
//要在demo里设置
$content = '极光推送';//安卓标题
$title = '我就是我看谁都上火';//安卓内容
$return_data = self::jiguang_send($receive, $title, $content, $platform, $m_type, $m_txt, $m_time);
if ($return_data === true) {
return 1;
}
return 0;
}
/**
* @param $receive 推送目标 别名、标签、注册 ID、分群、广播
* @param $content 推送内容
* @param $platform 推送平台 Android, iOS, Windows Phone 三个平台的推送 all 或者 { "platform" : ["android", "ios"] }
* @param $m_type extras JSON 格式的可选参数 key/value 形式
* @param $m_txt extras JSON 格式的可选参数 key/value