在laravel markdown邮件

时间:2017-06-15 14:30:19

标签: php laravel email

我在Laravel中收到以下降价邮件:

# Welcome to Offer Site
Thanks for listing your product, {{$user->name}}! 

@component('mail::button', ['url' => 'https://www.example.com/product/view/{{$product->id}}', 'color'=> 'orange'])
View it here
@endcomponent

但是,发送邮件时呈现的URL是https://www.example.com/product/view/%3C?php%20echo%20e(%24product-%3Eid);%20?%3E

这可能非常简单,但很难说出来......我如何确保将变量正确插入到URL栏中作为参数,这是在ProductAdded邮件的构建中:

return $this->markdown('emails.product-added-email');

这就是我传递给ProductAdded邮件:

\Mail::to($user)->send(new \App\Mail\ProductAdded($user, $product));

变量工作正常。

有什么想法吗?

1 个答案:

答案 0 :(得分:4)

您已经在php字符串中,没有必要使用刀片括号。您可以像这样连接字符串:

@component('mail::button', ['url' => 'https://www.example.com/product/view/' . $product->id, 'color' => 'orange'])