thinkphp3.2集成极光推送
项目中用到了给客户端的推送功能,选用了极光推送,下面演示一下在thinkphp中集成极光推送
1.下载极光推送的php类,可以从笔者的git下载
地址:https://git.oschina.net/zhangchao123/jiguangtuisongphplei.git
2.thinkphp集成
解压后,直接把jpush文件夹放在Thinkphp/Libray/Vender目录
/*
* 极光推送
* $pushId:极光ID,字符串或者array()
* $content:推送内容
* $remark:备注
* $type:推送类型参数array()
*/
function pushMessage($pushId,$content,$remark,$type){
vendor('JPush.JPush');
$jPush = C('jPush');
$app_key = $jPush['app_key'];
$master_secret = $jPush['master_secret'];
$client = new \JPush($app_key, $master_secret);
$result = $client->push()
->setPlatform('all')
->addRegistrationId($pushId)
->addAndroidNotification($content,"'".$remark."'", 1,$type)
->addIosNotification($content, 'iOS sound', '+1', true, 'iOS category',$type)
->send();
return $result;
}
最新文章
- C#设计模式系列:开闭原则(Open Close Principle)
- 使用Chrome工具来分析页面的绘制状态
- Mysql的ssl主从复制+半同步主从复制
- [翻译]The Neophyte's Guide to Scala Part 12: Type Classes
- jquery在线教程
- Python3 基础
- 【转】ListView与RadioButton组合——自定义单选列表
- c/c++ 直接使用动态库 dlopen
- vue-cli创建自己的项目
- PHPStudy+PHPStorm下配置隐藏项目入口文件
- 【一天一道LeetCode】#22. Generate Parentheses
- [Swift]LeetCode704. 二分查找 | Binary Search
- Asp.Net Core 下 Newtonsoft.Json 转换字符串 null 替换成string.Empty
- C#-类(九)
- Feature Extractor[inception v2 v3]
- echarts 导出图片,并将图片导出pdf格式
- MVC 中Delete 方法报错问题解决方案
- SpringBoot笔记--Jackson
- MacBook快速入门
- m序列c语言实现
热门文章
- Node中的cookie的使用
- HTML5新增的表单验证功能
- 给定一个整数数组和一个目标值,找出数组中和为目标值的两个数 例如给定nums = [2,7,11,15],target = 9
- java虚拟机-GC-新生代的GC、老年代的GC
- HDU 4461:The Power of Xiangqi(水题)
- 利用os模块生成 文件夹和文件
- 数据结构丨N叉树
- dubbo框架设计学习
- 简单的量子算法(二):Simon's Algorithm
- [leetcode] 7. Reverse Integer (easy)