Laravel 5: Display HTML with Blade

I have a string returned to one of my views, like this:

$text = '<p><strong>Lorem</strong> ipsum dolor <img src="images/test.jpg"></p>'

I'm trying to display it with Blade:

{{$text}}

However, the output is a raw string instead of rendered HTML. How do I display HTML with Blade in Laravel 5?

PS. PHP echo() displays the HTML correctly.


you need to do this way

{!! $text !!}

string will auto escape when you perform {{ }}


For laravel 5

{!!html_entity_decode($text)!!}

Figured out through this link, see RachidLaasri answer


You can try this:

{!! $text !!}

You should have a look at: http://laravel.com/docs/5.0/upgrade#upgrade-5.0

链接地址: http://www.djcxy.com/p/53072.html

上一篇: 如何在foreach blade laravel上访问prev或next阵列

下一篇: Laravel 5:用刀片显示HTML