我希望能够向数据库中的用户列表发送通知。
我找到了一种发送推送通知的解决方案:
我找到了一种发送推送通知的解决方案:
// request permission on page load
document.addEventListener('DOMContentLoaded', function () {
if (!Notification) {
alert('Desktop notifications not available in your browser. Try Chromium.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
});
function notifyMe() {
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
var notification = new Notification('Notification title', {
icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
body: "Hey there! You've been notified!",
});
notification.onclick = function () {
window.open("https://dev59.com/dm025IYBdhLWcg3wSkAq#13328397");
};
}
}
(来源:Chrome桌面通知示例)如何配置它以向特定用户发送特定通知?假设我想向用户通知表user_notification的所有用户发送通知。我尝试使用
<?php
$sqx = "SELECT * FROM `user_js` ";
?>
在代码中,但这也没有帮助