我已经创建了一份注册表。但是当我提交时出现以下错误消息
键“_username”必须是字符串,给定“NULL”
这是我的控制器
public function connexion(Request $request, AuthenticationUtils $authUtils, UserPasswordEncoderInterface $passwordEncoder) {
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
// 1) build the form
$user = new User();
$form_registration = $this->createForm(RegistrationType::class, $user);
// 2) handle the submit (will only happen on POST)
$form_registration->handleRequest($request);
if ($form_registration->isSubmitted() && $form_registration->isValid()) {
// 3) Encode the password (you could also do this via Doctrine listener)
$password = $passwordEncoder->encodePassword($user, $user->getPlainPassword()); …Run Code Online (Sandbox Code Playgroud) 我想使用 phpmailer 在电子邮件中包含图像,但有一个问题。我尝试在我的 symfony 应用程序中使用 swift mailer,但不起作用。我已经尝试了所有配置(所有主机、所有端口、所有加密等),在 3 天内我给它们打电话等,但没有成功。它在本地工作,而不是在远程环境中工作...无论如何,让我们回到我的问题。
我将 webpack 与 encore 一起使用(为 symfony4 设置资源的新方法)。我的所有图像都在公共文件夹中重命名。myimagename.65342324b5.jg 当我运行 encore 来部署资产时,I/O myimagename.jpg。
问题是当我想 AddEmbeddedImage 时
假设我在 asset 文件夹中有 logo.png 。当我部署资产时,它在公共图像文件夹中被重命名为 logo.536324324V3.png 。所以当我这样做时
$mail->AddEmbeddedImage('images/logo.png','mon_logo', 'logo.png');
Run Code Online (Sandbox Code Playgroud)
当我想在电子邮件的 html 正文中引用“mon_logo”时,图像不会加载,因为它不只存在 logo.536324324V3.png。
我有两个选择:
第二:我使这个脚本能够将 logo.png 识别为 logo.536324324V3.png。通常,它是在资产部署后自动生成的 manifest.json,但在我的情况下,图像的路径位于我的控制器中,因此我无法指定它是资产。
但我做不到
$mail->AddEmbeddedImage(" {{ asset('images/logo.png')}}",'mon_logo',
'标志.png');
无论如何,这没有任何意义。
所以如果你有解决方案,我会采纳:)
谢谢 :)