Home>Article>Backend Development> How to set the html tag not to be displayed in php

How to set the html tag not to be displayed in php

藏色散人
藏色散人 Original
2020-07-13 10:39:01 3095browse

In PHP, you can use the "strip_tags()" function to prevent html from being displayed. The function of this function is to strip the HTML, XML and PHP tags in the string. The syntax is "strip_tags(string,allow )", the parameter string represents the string to be checked.

How to set the html tag not to be displayed in php

How to set the html tags not to be displayed in php

You can use the PHP strip_tags() function

Running example

Definition and usage

strip_tags() function strips HTML, XML and PHP tags in a string.

Comments: This function always strips HTML comments. This cannot be changed via the allow parameter.

Note: This function is binary safe.

Syntax

strip_tags(string,allow)

Parameters

string Required. Specifies the string to check.

allow Optional. Specifies allowed tags. These tags will not be deleted.

Return value: Returns the stripped string.

PHP Version: 4

Change Log:

Since PHP 5.0, this function is binary safe.

Since PHP 4.3, this function always strips HTML comments.

Example

Strip the HTML tags in the string, but allow thetag:

world!",""); ?>

Input result:

How to set the html tag not to be displayed in php

For more related knowledge, please visitPHP Chinese website!

The above is the detailed content of How to set the html tag not to be displayed in php. For more information, please follow other related articles on the PHP Chinese website!

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