gpt4 book ai didi

php - 从数据库中检索数据,不包括 html 标签

转载 作者:行者123 更新时间:2023-12-01 00:06:11 25 4
gpt4 key购买 nike

如何从数据库中获取数据,数据格式为

<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 检索它。

提前致谢。

最佳答案

http://php.net/manual/en/function.strip-tags.php

一旦你从数据库中得到它,在你回显它之前在它上面运行这个函数:

$content = strip_tags($content);

编辑

问题经过编辑以显示特殊字符而不是原始 HTML。如果它那种风格,试试这样:

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

关于php - 从数据库中检索数据,不包括 html 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10121823/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com