title//push title, content//push content account//corresponding User token $type//Custom parameter
First go to the carrier Pigeon official website to apply for key, and then access key and reference xingeapp.php (available on the official website) because the following methods are based on the development of Xingeapp
protected function Pushaccoun ($title, $content, $account, $type) {
$pushAndroid = new Xingeapp (88888, ' 888888 ');
$pushIOS = new Xingeapp (888888, ' 888888);
$mess = new Message ();
$mess->settype (message::type_notification);
$mess->settitle ($title);
$mess->setcontent ($content);
$mess->setexpiretime (0);
$style = new Style (0);
#含义: Style number 0, ring, vibrate, not clear from the notification bar, does not affect the previous notification
$style = new Style (0, 1, 1, 1, 0);
$action = new ClickAction ();
$action->setactiontype (clickaction::type_activity);
#打开url需要用户确认
$action->setcomfirmonurl (0);
$mess->setstyle ($style);
$mess->setaction ($action);
$mess->setcustom (Array (' id ' = ' ", ' title ' = '" ' "', ' type ' = ' = $type)");
$messios = new Messageios ();
$messios->setexpiretime (0);
$messios->setalert ($content);
$messios->setbadge (1);
$messios->setsound ("");
$messios->setcustom (' id ' = ' + ', ' title ' = ' "', ' content ' = ' $content, ' type ' + $type));
$acceptTime 1 = new TimeInterval (0, 0, 23, 59);
$mess->addaccepttime ($acceptTime 1);
$ret = $pushAndroid->pushsingleaccount (0, $account, $mess);
$ret 1 = $pushIOS->pushsingleaccount (0, $account, $messios, Xingeapp::iosenv_dev);
$ret = Array ($ret, $ret 1);
return $ret;
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The above describes the PHP homing pigeon push (for token push), including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.