jpush php 发送不成功

设置 apns_production 为true 就可以成功了



public function jpush(){

$app_key =  Env::get('jpush.app_key');

    $master_secret =  Env::get('jpush.master_secret');

    $client =new JPush($app_key, $master_secret);

    $push_payload =$client->push()

->setPlatform('all')

->addAllAudience()

->setNotificationAlert('你好,xpower')

->options(array(

"apns_production" =>true  //true表示发送到生产环境(默认值),false为开发环境

    ));

    try {

$response =$push_payload->send();

        print_r($response);

    }catch (APIConnectionException$e) {

// try something here

        print $e;

    }catch (APIRequestException$e) {

// try something here

        print $e;

    }

}

你可能感兴趣的:(jpush php 发送不成功)