Php 从数据库中检索不包括html标记的数据

Php 从数据库中检索不包括html标记的数据,php,mysql,html,Php,Mysql,Html,如何从数据库中检索数据,其中数据的形式为 <p> </p> <p><span style="\">Classic Developers, a destination that offers every one luxurious and fulfilling yet affordable lifestyle. It is o

如何从数据库中检索数据,其中数据的形式为

<p> </p>
<p><span style="\">Classic Developers, a destination that offers every one luxurious and fulfilling yet affordable lifestyle. It is one of the emerging real estate developers in the country having diverse range of activities in varied business domain. We are a certified company having large scale projects in progress.</span></p>
<p><span style="\"><br /></span></p>
<p><span style="\">Classic Developers with its dynamic professional work force and uncompromising attitude in terms of construction methodologies and quality control procedures, we offer you Efficient, Elegant and Economical place, which will be called your home, your happiness. We are here not only for a residential place but to fulfill your dream of having a home with modern day comfort and soothing ambience. We not only offer modern structures with latest amenities but ensure all the valued customers with Earthquake resistant and VASTU compliant construction.</span></p>
<p> </p>
我需要不带html标记和其他样式的值。我只想要里面的文字。 如何使用php检索它

提前谢谢。

从数据库中获取后,在回显之前对其运行此函数:

$content = strip_tags($content);
编辑

该问题经过编辑以显示特殊字符,而不是原始HTML。如果是这种样式,请尝试以下方法:

$content = strip_tags(htmlspecialchars_decode($content));

从数据库中获取列后,可以使用
strip_tags()
方法清理输入。

如果您不想要@Ben Griffiths建议的简单解决方案,并且仍然需要纯DB处理,请查看正则表达式-请参阅