Home > Backend Development > PHP Problem > How to remove html tags in php

How to remove html tags in php

王林
Release: 2023-03-12 11:30:02
Original
3787 people have browsed it

How to remove html tags in php: Delete html tags by using the strip_tags() function, such as [strip_tags (string to be filtered);].

How to remove html tags in php

The operating environment of this article: windows10 system, php 7, thinkpad t480 computer.

We may encounter this situation when we are working. We need to filter a string, but this string also contains html tags. So how should we deal with this situation?

In fact, PHP provides us with a function strip_tags(). By using this function, we can easily filter strings with html tag codes.

<?php
    $str = &#39;你好,我是<br/>某某某&#39;;
    echo strip_tags($str);
?>
Copy after login

Input result: Hello, I am so-and-so

Comment: As can be seen from the above code, the strip_tags() function removes the "

Recommended learning: php training

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