我正在尝试使用 @foreach
在 markdown 模板中循环以发送邮件。
在@foreach 中使用 HTML 标签时,它无法正确呈现
@component('mail::message')
These are the latest contents in our website
@foreach($results as $type => $result)
<h4>{{ $result['name'] }}</h4>
@endforeach
Thanks,<br>
{{ config('app.name') }}
@endcomponent
在收到的邮件中,<h4>
标记将显示为,
<h4>Article</h4>
将 Markdown 放在 @foreach
中时未对其进行处理环形。但是当放在外面时它被处理了 @foreach
循环。
任何帮助将不胜感激。谢谢。
最佳答案
如 laravel documentation 中所述:
Do not use excess indentation when writing Markdown emails. Markdown parsers will render indented content as code blocks.
问题不在于 @foreach
中的 HTML 标签,但缩进使解析器呈现如下(我现在使用 markdown,<h4>
之前有 4 个空格):
<h4>Article</h4>
关于php - Laravel- 在 Markdown 邮件中使用@foreach,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48537708/