tp5 去掉(html代码)文本编辑器上传内容中的html标签元素

/* 去掉文章内容中的html页面标签 */
$user_article_list = ‘’;//获取数据库中的内容数组
foreach ($user_article_list as $key => $value) {
    $value['article_content'] = str_replace(" ","",$value['article_content']);//去掉空格
    $value['article_content'] = strip_tags($value['article_content']);//函数剥去字符串中的 HTML、XML 以及 PHP 的标签,获取纯文本内容
    $user_article_list[$key]['article_content'] = $value['article_content'];
}
$this->assign('user_article_list',$user_article_list?$user_article_list:0);

转载:https://blog.csdn.net/weixin_40047834/article/details/79988778

猜你喜欢

转载自blog.csdn.net/haibo0668/article/details/86352468