首页 > 解决方案 > Laravel 重置密码电子邮件不适用于生产

问题描述

当我尝试忘记密码并在我的 laravel 应用程序中输入我的电子邮件时收到此错误:

传递给 DOMNode::removeChild() 的参数 1 必须是 DOMNode 的实例,给定 null

我今天早些时候发布了这个问题,但没有得到任何回应。(请阅读问题和评论。)所以我正在为问题添加更多细节,因为旧问题现在可能不会引起太多关注,所以我要问一个新问题。

我开始跟踪请求并转储变量以查看生产机器和本地机器之间的差异在哪里。(顺便说一句,生产服务器和本地服务器现在都具有相同的 php 版本。)

里面有这个功能

供应商/laravel/framework/src/Illuminate/Mail/Markdown.php

/**
 * Render the Markdown template into HTML.
 *
 * @param  string  $view
 * @param  array  $data
 * @param  \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles|null  $inliner
 * @return \Illuminate\Support\HtmlString
 */
public function render($view, array $data = [], $inliner = null)
{
    $this->view->flushFinderCache();
    $contents = $this->view->replaceNamespace(
        'mail', $this->htmlComponentPaths()
    )->make($view, $data)->render();

    return new HtmlString(($inliner ?: new CssToInlineStyles)->convert(
        $contents, $this->view->make('mail::themes.'.$this->theme)->render()
    ));
}

我转储了变量$view,并$data在生产和本地都给出了相同的值:

变量视图:"notifications::email"

可变数据:

array:8 [▼
  "level" => "info"
  "subject" => null
  "greeting" => null
  "salutation" => null
  "introLines" => array:1 [▶]
  "outroLines" => array:1 [▶]
  "actionText" => "Change Password"
  "actionUrl" => "http://localhost:8000/password/reset/ff6f1edf6793bf4fadf462781e5258980ddd3c94e545b3b9744b279842f75d93"
]

但是当我转储$contents变量时,在这个代码段之后:

$contents = $this->view->replaceNamespace(
    'mail', $this->htmlComponentPaths()
)->make($view, $data)->render();

结果在我的服务器中为空,而在我的本地机器中,它转储了电子邮件的 html,这就是我想要的。

有人看到这里的问题吗?

标签: phplaravelauthentication

解决方案


推荐阅读