Marc Rasmussen
Marc Rasmussen

Reputation: 20565

PHP / Laravel echo HTML

So i have the following value:

$content = "<ol><li>AbC</li></ol><p>sd</p>"

Now I wish to display this on my page.blade.php

But I am not quite sure how to do it. I have attempted with:

{{$content}}

But as expected it just prints the HTML and does not actually inject it.

So my question is how do I inject the HTML?

Upvotes: 2

Views: 743

Answers (3)

Munkhtsol
Munkhtsol

Reputation: 1

Try following code:

 {! html_entities_decode($content) !}

Upvotes: 0

Sohel0415
Sohel0415

Reputation: 9863

Try the following-

{!!$content!!}

{{ }} will result in auto escape of string.

Upvotes: 3

Danish Jamshed
Danish Jamshed

Reputation: 101

Make sure you are passing variable to your view. Then you can access this by 2 ways:

{{!! $content !!}}

or

<?php echo $content; ?>

Upvotes: 0

Related Questions