app_key = "ac660c2f91692e1a56243647"; $this->master_secret = "a5275f7fd53959a63ef50aa5"; $this->client = new JPush($this->app_key, $this->master_secret); } public function test(){ var_dump(222123122222);die; } //获取alias和tags public function getDevices($registrationID){ $result = $this->client->device()->getDevices($registrationID); return $result; } //添加tags public function addTags($registrationID, $tags) { $result = $this->client->device()->addTags($registrationID, $tags); return $result; } //移除tags public function removeTags($registrationID, $tags) { $result = $this->client->device()->removeTags($registrationID, $tags); return $result; } //标签推送 public function push($tag, $alert) { $tags = implode(",", $tag); $this->client->push() ->setPlatform(array('ios', 'android')) ->addTag($tags) //标签 ->setNotificationAlert($alert) //内容 ->send(); } //别名推送 public function aliasPush($alias, $alert) { $alias = implode(",", $alias); $this->client->push() ->setPlatform(array('ios', 'android')) ->addAlias($alias) //别名 ->setNotificationAlert($alert) //内容 ->send(); } }