I want remove HTML tags (all) from a string on laravel blade ...
code
{!! \Illuminate\Support\Str::words($subject->body, 5,'...') !!}
output (example)
<p>hassen zouari</p>
I want that it be like this
hassen zouari
You can always use strip_tags() with a second parameter containing the allowable tags. preg_replace('/<script>(. *)</script>/i', '$1', $input);
To strip out all the HTML tags from a string there are lots of procedures in JavaScript. In order to strip out tags we can use replace() function and can also use . textContent property, . innerText property from HTML DOM.
Strip_tags() is a function that allows you to strip out all HTML and PHP tags from a given string (parameter one), however you can also use parameter two to specify a list of HTML tags you want.
csv using open() function in 'read' mode. We further call readlines() to read the file content into a python list. Then we re-open the file in 'write' mode using open() function. We loop through the list items one by one and call cleanhtml() function on each line, to remove any HTML tags in it.
Try to use strip_tags()
function:
http://php.net/manual/en/function.strip-tags.php
Update: Try to do something like this in a controller:
$taglessBody = strip_tags($subject->body);
Then pass this variable into a blade template and use it instead of $subject->body
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With