Home > Backend Development > PHP Tutorial > How to convert text with html tags into plain text in php

How to convert text with html tags into plain text in php

WBOY
Release: 2023-03-01 13:52:01
Original
1664 people have browsed it

Tag phphtml

Such as the following text
How to convert text with html tags into plain text in php

Reply content:

preg_replace regular replacement
http://www.jb51.net/article/27706.htm

<code> <?php $s="<a>aaaa<b>bbbbb</b><font color="red">cc</font>";
echo $s."<br>";
$s= preg_replace("/]+>/is", "", $s);
echo $s;
?>
</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template