Skip to content
Advertisement

Removing html tags in Laravel blade

I have an issue with deleting HTML tags. Well I get string from database

$desc = "<p>Test 1</p>";

And when I filter variable with htmlspecialchars and other, I have < and something else. Is there any function which can just remove tags and set variable to

$desc = "Test 1";

Advertisement

Answer

just use {!! $variable !!} to remove the tags from being visible on the output.

Updated after further clarification from the op

because of the output you will need to use: strip_tags(htmlspecialchars_decode($desc))

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement