2017-11-18 177 views
0

我有電子郵件模板類似下面Laravel刀片包括部分未解析HTML

@component('mail::message') 
# You're invited for APP 

<strong>{{ $fromName }}</strong> invited you for App. 

{{ $messageBody }} 

<?php switch ($type): 
    case App\Mail\InviteEmail::TYPE_INVITE_EMAIL: 
?> 
     @include('emails.partials.invite') 
<?php break; 
    case App\Mail\InviteEmail::TYPE_EXPLAINER_EMAIL: 
?> 
     @include('emails.partials.explainer') 
<?php break; 
    case App\Mail\InviteEmail::TYPE_INTRO_EMAIL: 
?> 
     @include('emails.partials.intro') 
<?php break; 
endswitch; 
?> 
@endcomponent 

但當它來行動,@include諧音不解析HTML代碼,而不是他們內部的一些「代碼」呈現標籤。下面就是我得到

enter image description here

回答

0

輸出HTML的輸出,你必須逃避它,即。

{!! $messageBody !!}. 

見文檔:https://laravel.com/docs/5.5/blade#displaying-data

+0

'''$ messageBody'''正常工作已經,只是需要一些解決方案,其中包括我的文件'''@include( 'emails.partials.invite')'' ' –