本文整理匯總了PHP中Pusher::push方法的典型用法代碼示例。如果您正苦於以下問題:PHP Pusher::push方法的具體用法?PHP Pusher::push怎麽用?PHP Pusher::push使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pusher
的用法示例。
在下文中一共展示了Pusher::push方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Pusher
<?php
include "pusher.php";
$push = new Pusher();
$push->set_ios('Password', 'path/to/cert.pem');
$push->set_ios_devices('deviceToken');
$push->set_android("apitoken");
$push->set_android_devices("deviceToken");
$push->set_message("Notification with custom data");
$push->set_title("Custom data");
$push->set_number(1);
$push->set_sound("default");
$push->set_custom('{"x":157,"y":100}');
$push->push();
print_r($push->get_errors());
示例2: newNoti
public function newNoti()
{
//獲取客戶端發送的json
$arr = json_decode($GLOBALS['HTTP_RAW_POST_DATA']);
$uid = 111;
//用戶名為學號,也是數據庫中的ID
//$id=$arr->id;//文章ID號(為14位年月日時分秒)
$title = "123";
//$arr->title;//$arr->noti->title;//文章標題
//$uid=$arr->username;//創建該文章的用戶ID
// $date=$arr->date;//創建文章的年月日時分秒
//$tid=$arr->tid;//
$bodyofhtml = "<p>111</p>";
//$arr->content;//$arr->noti->content;//文章的內容(保存為html)
$grade = "研一;研二;研三";
//$arr->noti->viewlevel;//可查看該文章的年級
//對時間進行處理;
// $datetime= date("YmdHis",strtotime($date));//獲取當前時間
$datesql = date("Y-m-d", strtotime('now'));
//
$Model = new Model();
//從數據庫中獲取一個整數型的uuid,並設置為文章的ID號
$sql = "select uuid_short();";
$res = $Model->query($sql);
$id = $res[0]['uuid_short()'];
$sql = "insert into __PREFIX__article(id,title,uid,date,body,grade)\r\n values ({$id},'{$title}',{$uid},'{$datesql}','{$bodyofhtml}','{$grade}')";
if ($Model->execute($sql)) {
$suc = 1;
} else {
$suc = 0;
}
$datesql = date("Y-m-d", strtotime($datesql));
$jsonsend = array("title" => $title, "date" => $datesql, "jwt" => $json->jwt);
$json = json_encode($jsonsend);
//向數據庫中增加表
$this::insertNotiuser($id);
$config = array('from' => '123', 'to' => '', 'content' => $title, 'viewlevel' => '1', 'action' => '1');
vendor("messagePush-master.Pusher");
vendor("messagePush-master.MessageBuilder");
$result = \Pusher::push((new \MessageBuilder($config))->build());
}