美文网首页
jpush php 发送不成功

jpush php 发送不成功

作者: _Net_ | 来源:发表于2019-03-13 16:33 被阅读0次

设置 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 发送不成功

      本文链接:https://www.haomeiwen.com/subject/gajtmqtx.html