简体   繁体   English

如何使用PHP从文本中删除html标签

[英]How to remove html tags from a text with PHP

I have retrieved some data from my MySQL database table in a text area field: 我已经从我的MySQL数据库表的文本区域字段中检索了一些数据:

<textarea class='sendDesc insert' name='blog_body' placeholder='".$blogReturn->GetBlogBody()."'></textarea>

And it shows this as result: 结果显示为:

打印屏幕

Now what I want to do is to remove the html tags such as <p> tags from this text. 现在,我要做的是从此文本中删除html标签,例如<p>标签。 So only the text will show on screen .. (with the applied css settings). 因此,仅文本将显示在屏幕上(使用已应用的CSS设置)。

So how can I do that? 那我该怎么办呢?

使用strip_tags()

echo strip_tags("Hello <p>world!</p>");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM