1. 程式人生 > >php 第三方 極光推送domo(Android版)

php 第三方 極光推送domo(Android版)

 效果例項:

                                    

  實現過程:

  首先登陸極光註冊賬號

   極光官網

註冊賬號

  建立應用:

  

 進入應用

 

用手機掃描二維碼安裝 手機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!!!!!