Notifications 我的网站推送通知的开发

Notifications 我的网站推送通知的开发,notifications,push,Notifications,Push,我试图了解我们是否可以使用桌面通知实现对浏览器的推送通知,我相信这就是Web通知。我尝试过创建一些PHP代码,但没有成功 这些是我的php函数的代码 public function notification(){ $rows=array(); $notifList = $this->admin_model->listNotificationUser($this->session->userdata('username')); //print_r(

我试图了解我们是否可以使用桌面通知实现对浏览器的推送通知,我相信这就是Web通知。我尝试过创建一些PHP代码,但没有成功

这些是我的php函数的代码

public function notification(){
    $rows=array(); 
    $notifList = $this->admin_model->listNotificationUser($this->session->userdata('username'));
    //print_r('<pre>');print_r($notifList);die;
    $record = 0;
    foreach($notifList as $key) {
        $data['title'] = $key->title;
        $data['msg'] = $key->notif_msg;
        $data['icon'] = 'https://webmentorz.com/assets/admin/img/log.png';
        $data['url'] = 'https://webmentorz.com/';
        $rows[] = $data;
        $nextime = date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s'))+($key['notif_repeat']*60));
        $this->admin_model->updateNotification($key->id,$nextime);
        $record++;
    }
    $array = array(
        "notif" => $rows,
        "count" => $record,
        "result" => TRUE
    );
    echo json_encode($array);
}
公共功能通知(){
$rows=array();
$notifList=$this->admin\u model->listNotificationUser($this->session->userdata('username'));
//打印(“”);打印($notifList);死亡;
$record=0;
foreach($notifList作为$key){
$data['title']=$key->title;
$data['msg']=$key->notif\u msg;
$data['icon']='https://webmentorz.com/assets/admin/img/log.png';
$data['url']='https://webmentorz.com/';
$rows[]=$data;
$nextime=date('Y-m-dh:i:s',strotime(date('Y-m-dh:i:s'))+($key['notif_repeat']*60));
$this->admin\u model->updatenofication($key->id,$nextime);
$record++;
}
$array=array(
“notif”=>$rows,
“计数”=>$record,
“结果”=>TRUE
);
echo json_编码($array);
}