Get the App
SLTechnology News&Howtos  ›  Development  › 

How to remove html tags from php

Shulou Source: shulou.com Published: 2022-06-03 15:48:45 11月14日 Update

This article will explain in detail how php removes html tags. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

We may encounter this situation at work, where we need to filter a string, but this string has a html tag in it. So how should we deal with this situation?

1. PHP provides us with a function strip_tags ().

2. By using this function, we can easily filter strings with html tag codes.

Str = 'Hello, I'm so-and-so'; echo strip_tags ($str);? >

Input result: Hello, I am a certain person

Note: as you can see from the above code, the strip_tags () function sets the "

"the label was filtered out.

This is the end of this article on "how to remove html tags from php". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Tags characters strings functions articles code hello situation more good practical content articles times comments knowledge results face-to-face references work Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Redmi Microsoft Apple MariaDB