PHP code example of photonsdk / push
1. Go to this page and download the library: Download photonsdk/push 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/ */
photonsdk / push example snippets
知栏消息
//透传消息
$iPush = \Photon\Push::getFactory();
//一般通知栏消息发送
echo $iPush->notification
->setAppid("xxx")
->setAppKey("xxxx")
->setPackageName("com.photon.xxx")
->setTarget("10000")
->setTitle("title_".rand(0, 100))
->setContent("content_".rand(0, 100000))
->setPushType("ALIAS")
->setSource("0")
->setActions("OPEN_URL", "http://www.immomo.com")
//添加高级特性
->useSuper
->setOffLineTtl(259200)
->setOffLine(1)
->setNotifyId("226")
->setShowOnlyBackstage(0)
->setSoundSwitch(1)
->setVendorPushSwitch(1)
->setPopNotify(0)
->setAutoCancel(0)
->setPicture("http://img.momocdn.com/event/88/2B/882B56DA-24B5-413A-207F-60690D1067E920190312_250x250.jpg")
->setDmData("{\"_data\":\"{\\\"taskId\\\":\\\"204\\\"}\"}")
->push();