PHP code example of syicd / pushbox
1. Go to this page and download the library: Download syicd/pushbox library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
syicd / pushbox example snippets
修改 env
XM_SECRET=
XM_PACKAGE=
//组织参数
$param = [
'title' => '这是消息推送的title',
'contents' => '消息内容',
'data' => "{'data':'这是json数据包'}",
'target' => '目标regid',
];
//实例化对象
$xm = new xiaomi();
$xm->_behavior();//行为: 1.透传 0.通知栏 默认: 0
$xm->_action();//动作: 1.one 2.multi 3.all 默认:one
$xm->_init($param);//初始化对象 并接受参数
$xm->_push();//执行推送
$xm->_response();//接受返回信息 json