加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

如何使用php从HTML中删除标签及其内容

发布时间:2020-12-13 13:21:55 所属栏目:PHP教程 来源:网络整理
导读:以下是我需要移除的文字 p来自的标签 p Addiction,stress and subjective wellbeing/p p The need and significance of traditional shop lot pavements in the context of town conservation in Malaysia/p p The role of wage and benefit in engaging emp
以下是我需要移除的文字< p>来自的标签
<p> Addiction,stress and subjective wellbeing</p> 
<p> The need and significance of traditional shop lot pavements in the context of town conservation in Malaysia</p> 
<p> The role of wage and benefit in engaging employee commitment</p>

我试过这个

$title= preg_replace('#<p>(.*?)</p>#','',$title['result']);**

但仍然是< p>标签,任何想法?

只是为了删除p标签,你可以这样做
$text=str_ireplace('<p>',$text);
$text=str_ireplace('</p>',$text);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读