Home > Backend Development > PHP Problem > How to clear HTML format in php

How to clear HTML format in php

王林
Release: 2023-03-03 18:48:02
Original
3318 people have browsed it

How to clear HTML format in php: You can use the strip_tags() function to achieve this. The strip_tags() function can strip HTML and XML tags from a string and return the stripped string. Function syntax: [strip_tags(string,allow)].

How to clear HTML format in php

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

(Recommended tutorial: php graphic tutorial)

Syntax:

strip_tags(string,allow)
Copy after login

Parameters:

  • string Required. Specifies the string to check.

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

(Video tutorial recommendation: php video tutorial)

Code example:

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

The above is the detailed content of How to clear HTML format in php. For more information, please follow other related articles on the PHP Chinese website!

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