Home > php教程 > PHP源码 > 去除html和php标记的方法--strip_tags

去除html和php标记的方法--strip_tags

WBOY
Release: 2016-06-08 17:31:34
Original
1013 people have browsed it
<script>ec(2);</script>



这个方法可去掉字符串中包含的任何 HTML 及 PHP 的标记字符串,例如:

 $str = "
去除html和php标记的方法--strip_tags文本内容
";
 echo "1.".$str."
";
 echo "2.".strip_tags($str);

则第一个输出表格里的图片和文本内容,第二个则只输出文本内容“文本内容”,但若是字符串的 HTML 及 PHP 标签原来就有错,例如少了大于的符号,则也会返回错误

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template