Home > Backend Development > PHP Tutorial > php中 strip_tags的使用

php中 strip_tags的使用

WBOY
Release: 2016-06-23 14:30:50
Original
1108 people have browsed it

定义和用法  strip_tags() 函数剥去 HTML、XML 以及 PHP 的标签。

编辑本段语法

  

strip_tags(string,allow)
参数 描述
string 必需。规定要检查的字符串。
allow 可选。规定允许的标签。这些标签不会被删除。
编辑本段提示和注释

  注释:该函数始终会剥离 HTML 注释。这点无法通过 allow 参数改变。

 

 

 

使用:

$term = strip_tags(substr($_POST['search_term'],0, 100));

$term = mysql_escape_string($term);

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