芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/network.digitalhubbd.com/fns/push_notification/firebase.php
firebase_private_key)) { $firebase_pkey = 'fns/push_notification/firebase_key/'.Registry::load('settings')->firebase_private_key; if (file_exists($firebase_pkey)) { $factory = (new Factory) ->withServiceAccount($firebase_pkey); $messaging = $factory->createMessaging(); $data['link'] = Registry::load('config')->site_url; $notification = Notification::create($data['title'], $data['message']); $message = CloudMessage::new()->withNotification($notification); try { $sendReport = $messaging->sendMulticast($message, $data['device_tokens']); $response = "Notification sent successfully!"; } catch (\Kreait\Firebase\Exception\MessagingException $e) { $response = "Error sending notification: " . $e->getMessage(); } $result = array(); $result['response'] = $response; } }