Code Monkey home page Code Monkey logo

huaweipush's Introduction

huaweipush

php服务端 华为推送 huawei push

$push=new  huaweiPush("100xxxx53","9c6484exxxxx05eb0a91c49b1bfc2a2d");

// 然后可以这样使用。

$title = '推送的消息标题';

$message = '需要推送的消息内容';

$AccessToken=$push->getAccessToken();//获取AccessToken 可以保存起来
$push->setTitle($title)
    ->setMessage($message)
    ->setAccessToken($AccessToken)
    ->setAppPkgName("com.cug.maintenance") //设置包名称
    ->setCustomize(["你好"]) //设置自定义参数 (点击app后可以应用可获取的参数)
//    ->addDeviceToken('0865831037206556300001986600CN01')
    ->addDeviceToken('0865831037206556300001986600CN01');
$push->sendMessage(); // 执行推送消息。
    
$push->sendMessage(); // 执行推送消息。
var_dump($push->isSendSuccess()); //是否推送成功
var_dump($push->isSendFail()); //是否推送失败
var_dump($push->getAccessTokenExpiresTime()); //获取AccessToken 过期时间
var_dump($push->getSendSuccessRequestId()); //获取推送成功后接口返回的请求id
//$push->test();

image 点击后打开 image

huaweipush's People

Contributors

huangyongda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.