How to remove html tags in php: Delete html tags by using the strip_tags() function, such as [strip_tags (string to be filtered);].
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 = '你好,我是<br/>某某某'; 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!