search
HomeBackend DevelopmentPHP ProblemHow to remove html tags in php

How to remove html tags in php

Sep 06, 2021 pm 05:09 PM
htmlphpLabel

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);
?>

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function