I want remove HTML tags (all) from a string on laravel blade ...
code
{!! \Illuminate\Support\Str::words($subject->body, 5,'...') !!}
输出(示例)
<p>hassen zouari</p>
I want that it be like this
hassen zouari
I want remove HTML tags (all) from a string on laravel blade ...
code
{!! \Illuminate\Support\Str::words($subject->body, 5,'...') !!}
输出(示例)
<p>hassen zouari</p>
I want that it be like this
hassen zouari
Try to use strip_tags()
function:
http://php.net/manual/en/function.strip-tags.php个
Update:个 try 在控制器中执行以下操作:
$taglessBody = strip_tags($subject->body);
Then pass this variable into a blade template and use it instead of $subject->body
.