PHP code example of mofing / umeng
1. Go to this page and download the library: Download mofing/umeng 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/ */
mofing / umeng example snippets
use UmengPusher\Umeng\Pusher\UmengPusher;
$settings = [
"android" => [
"app_key" => "aaa",
"app_master_secret" => "bbbb"
],
"product" => false
];
$umeng = new UmengPusher($settings);
$device_token = 'xxxx';
$predefined = [
"after_open" => "go_custom",
"ticker" => "测试提示文字",
"title" => "测试标题",
"text" => "测试文字描述",
"custom" => [
"name" => "ddd"
]
];
$extraField = array(); //other extra filed
$umeng->android()->sendUnicast($device_token,$predefined,$extraField); //单播
use UmengPusher\Umeng\Pusher\UmengPusher;
$settings = [
"ios" => [
"app_key" => "aaa",
"app_master_secret" => "bbbb"
],
"product" => false
];
$UmengPusher=new UmengPusher($settings);
$device_token = 'xxxx';
$predefined = [
'alert' => [
"title" => "title",
"subtitle" => "subtitle",
"body" => "这里是消息数据"
]
];
$customField = array(); //other custom filed
$UmengPusher->ios()->sendUnicast($device_token,$predefined,$customField); //单播