在Laravel刀片中删除html标签 [英] Removing html tags in Laravel blade
本文介绍了在Laravel刀片中删除html标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在删除HTML标签时遇到问题.好吧,我从数据库中获取了字符串
I have an issue with deleting HTML tags. Well I get string from database
$desc = "<p>Test 1</p>";
当我使用htmlspecialchars等过滤变量时,我有<还有其他的东西.有没有什么功能可以删除标签并将变量设置为
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";
推荐答案
只需使用{!! $variable !!}
即可删除标记,使它们在输出中不可见.
just use {!! $variable !!}
to remove the tags from being visible on the output.
在操作员进一步澄清后进行了更新
因为要使用输出,所以需要使用:strip_tags(htmlspecialchars_decode($desc))
because of the output you will need to use: strip_tags(htmlspecialchars_decode($desc))
这篇关于在Laravel刀片中删除html标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文