我正在开发 Angular 渐进式 Web 应用程序,当我使用ng serve它运行应用程序时,它在浏览器中运行良好,并在 Service Worker 上提供后台通知。
但相同的功能不适用于使用 Capacitor 构建工具创建的移动应用程序npx cap add android。
我的firebase-service-worker.js文件:
importScripts('https://www.gstatic.com/firebasejs/5.5.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/5.5.0/firebase-messaging.js');
firebase.initializeApp({
'messagingSenderId': '65358642427'
});
const messaging = firebase.messaging();
messaging.setBackgroundMessageHandler(function (payload) {
var notificationTitle = JSON.parse(payload.notification).title;
var notificationOptions = {
body: JSON.parse(payload.notification).body
};
return self.registration.showNotification(notificationTitle, notificationOptions);
});
Run Code Online (Sandbox Code Playgroud) push-notification firebase progressive-web-apps angular capacitor
我有这个片段,它使用我在 env 中设置的邮件枪 API 发送电子邮件。它全部发送,但我现在想从用户那里选择变量,并根据输入设置一些其他信息
$name = $request->name;
$name2 = 'hello';
$email = $request->email;
$message = $request->message;
Mail::raw($message, function($message)
{
$message->from('hello@hello.com', 'In-app Correspondence By -- ')->subject('Welcome!');
$message->to('pr@example.com')->cc('me@gmail.com');
});
Run Code Online (Sandbox Code Playgroud)
问题是当我输入时$message->to($email)->cc('me@gmail.com');会出现内部服务器错误,但上面的代码工作正常。
电子邮件没问题,我检查过,但确实存在。我还想对消息进行回复并插入 $email 变量。到目前为止,回复甚至将 $email 放在该主题上都会导致内部服务器错误。
可能是什么问题。