效果实例:
实现过程:
首先登陆极光注册账号
注册账号
创建应用:
进入应用
用手机扫描二维码安装 手机apk 应用
在下载 php sdk 包
解压放到自己访问根目录下
新建 newsend.php
<?php
require_once 'jpush-api-php-client-3.5.7/autoload.php' ;
use JPush\Client as JPush;
$app_key = '1feb97a4963e36333a409133';
$master_secret = '97cdb0ab3d5984ae0d9535be';
$client = new JPush($app_key, $master_secret);
// $client->push()
// ->setPlatform('all')
// ->addAllAudience()
// ->setNotificationAlert('woshihaiyong168')
// ->send();
$pusher = $client->push();
$pusher->setPlatform('all');
$pusher->addAllAudience();
$pusher->setNotificationAlert('Hello, JPush');
try {
$pusher->send();
} catch (\JPush\Exceptions\JPushException $e) {
// try something else here
print $e;
}
?>
访问 newsend.php 完成功能demo!!!!!