world!", "");] ."/> world!", "");] .">

Home  >  Article  >  Backend Development  >  How to delete html tags in php

How to delete html tags in php

王林
王林Original
2020-11-05 14:24:102415browse

How to delete html tags in php: You can use the strip_tags function to delete, such as [strip_tags("Hello world!",""); 】.

How to delete html tags in php

The strip_tags() function strips HTML, XML and PHP tags from a string and returns the stripped string.

(Video tutorial recommendation: java video tutorial)

Syntax:

strip_tags(string,allow)

Parameter introduction:

string Required. Specifies the string to check.​

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

Example:

Strip the HTML tags in the string, but allow the use of a4b561c25d9afb9ac8dc4d70affff419 tags

<?php
    echo strip_tags("Hello <b><i>world!</i></b>","<b>");
?>

Related recommendations:php training

The above is the detailed content of How to delete html tags 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