【发布时间】:2019-07-30 15:46:05
【问题描述】:
我正在使用 Laravel 中的 Mail 库来发送带有自定义数据的 html 电子邮件,并传递给刀片视图。
当邮件必须呈现从数据库中的一行获取的 html 时产生的问题,其中包含我通过视图传递的变量。
这是我的可邮寄类中的构建函数
public function build()
{
return $this->from('hello@test.it')
->view('view')
->with([
'url' => 'https://google.com',
'text' => $this->parameters->text,
]);
}
然后在刀片视图中:
<div>
{!! $text !!}
</div>
这是 $text 变量的样子:
<p>
<span>This is my text for the mail</span>
<a href="{{ $url }}">Click here to compile</a>
</p>
链接href应该包含url变量值而不是不传递变量名本身
【问题讨论】: