Home  >  Article  >  php教程  >  strip_tags 函数用法与实例教程

strip_tags 函数用法与实例教程

WBOY
WBOYOriginal
2016-06-13 11:16:471642browse

 

定义和用法
该strip_tags ( )函数作用却除所有HTML , XML和PHP的标记。

语法

strip_tags(string,allow)

		参数
说明
string 必需的。指定的字符串检查
allow 任择。指定允许的标签。这些标签不会被删除


提示和说明 注意:评论的HTML总是剥夺。这不能改变的允许参数。 范例1

 

<!--?phpecho strip_tags("Hello <b-->world!");?>
结果为.

Hello world!
 
再来看一个<strong>strip_tags</strong>函数的例子
 

<!--?phpecho strip_tags("Hello <b--><i>world!</i>","<b>");?></b>
<b> </b>

<b>Hello <strong>world!</strong></b>

Statement:
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