直接下载PHPdemo 直接运行代码就可以推送啦 当然前提要客户端 要写好极光推送sdk
核心代码
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
require_once("../src/JPush/JPush.php");$br = '<br/>';
$app_key = 'a1fe2663521eabaffdab2768';
$master_secret = '34143ac8f0bf5cd029bd39be';$message=$_POST['message'];
//别名就是手机号
$tel=$_POST['tel'];
$type=$_POST['type'];
// 初始化
$client = new JPush($app_key, $master_secret);// 别名推送
if($type!=0){
$result = $client->push()
->addAlias($tel)
->setPlatform('all')
->setNotificationAlert($message)
->send();
}else{
$result = $client->push()
->setPlatform('all')
->addAllAudience()
->setNotificationAlert($message)
->send();
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/19163.html