N
N
nzozmsot2017-05-12 18:26:05
Laravel
nzozmsot, 2017-05-12 18:26:05

Laravel blade exceptions when escaping?

Hello. I output the data, its approximate form:

<a href="https://google.com">GOOGLE</a>
<i>cba</i>

I output it like this: {{ $var }}
Everything is displayed as is, but you need to make it so that, for example, "GOOGLE" is displayed as a link, and "cba" as is ( <i>cba</i>). How to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nik Gubin, 2017-05-12
@gubin_niko

It's a little unclear what you need, but to display the contents of a variable without escaping, you need to do this:
{!! $var !!}
You can also output two variables, but wrap the second one in the e() function and it will be output with escaping:
{!! $var. e($escapeVar) !!}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question