ios证书版本根据别名推送不成功测试版本能推送成功
$content=iconv('GB2312', 'UTF-8',$content);//推送内容
$client = new \JPush\Client("111111111111111111111", "111111111111111111");
$result = $client->push()
->setPlatform('ios')
->addAlias($alias)
->addTag(array('yueshao'))
->androidNotification($content, [
'extras' => [
'type' => "order_info",
'order_number'=>$order_number
]
])
->iosNotification($content, [
'sound' => 'sound',
'badge' => '0',
'extras' => [
'type' => "order_info",
'order_number'=>$order_number
]])
->options(array(
"apns_production" => true //true表示发送到生产环境(默认值),false为开发环境
))
->send();
打印日志
09:15:49 array (
'body' =>
array (
'sendno' => '45459',
'msg_id' => '2225062923',
),
'http_code' => 200,
'headers' =>
array (
0 => 'HTTP/1.1 200 OK',
'Server' => 'nginx',
'Date' => 'Sat, 23 Jun 2018 01:15:49 GMT',
'Content-Type' => 'application/json',
'Content-Length' => '40',
'Connection' => 'keep-alive',
'X-Rate-Limit-Limit' => '600',
'X-Rate-Limit-Remaining' => '598',
'X-Rate-Limit-Reset' => '37',
'X-Jpush-Msgid' => '2225062923',
),
)