如何解决我们可以用php从pusher获取数据吗
我正在学习pusher,我可以看到获取需要使用jquery的实时数据,并将数据推送到后端需要使用php语言,我们可以使用php而不是jquery来获取该数据吗?可能吗 ?我还能看到pusher仅实时工作,如果刷新页面并需要获取所有存储的pusher数据,会发生什么情况?
backend.php
$options = array(
'cluster' => 'ap2','encrypted' => true
);
$pusher = new Pusher\Pusher(
'***','***',$options
);
if($pusher->trigger('test_channel','my_event',$data)) {
echo 'success';
} else {
echo 'error';
}
index.html
var channel = pusher.subscribe('test_channel');
// bind the server event to get the response data and append it to the message div
channel.bind('my_event',function(data) {
console.log("event data");
console.log(data);
});
我们可以用php获取那些数据吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。