Home  >  Article  >  Backend Development  >  strip_tags function usage and examples tutorial_PHP tutorial

strip_tags function usage and examples tutorial_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:00:301066browse

Definition and usage
The strip_tags() function removes all HTML, XML and PHP tags.

Grammar

strip_tags(string,allow)

		参数
说明
string 必需的。指定的字符串检查
allow 任择。指定允许的标签。这些标签不会被删除
illustrate
string Required. Specified string check
allow Optional. Specify allowed tags. These tags will not be deleted


Tips and Instructions NOTE: Comments are always stripped of their HTML. This cannot be changed as an allowed parameter. Example 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>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445526.htmlTechArticleDefinition and Usage The strip_tags() function removes all HTML, XML and PHP tags. Syntax strip_tags(string,allow) Parameter Description string Required. Specified string check...
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