php remove html tag style

藏色散人
Release: 2023-03-08 17:44:01
Original
2062 people have browsed it

php method to remove html tag style: first create a PHP sample file; then define a piece of HTML text; finally use PHP's built-in function "strip_tags()" to clear the HMTL tag.

php remove html tag style

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

Create a new PHP document and define a paragraph containing html tags String, example:

$html = '百度经验欢迎您'; echo $html;
Copy after login

php remove html tag style

Save the above content, view it in the browser, and clear the effect before HTML tags,

php remove html tag style

Use PHP's built-in function strip_tags() to clear HMTL tags. Example:

$eraser = strip_tags($html); echo $eraser;
Copy after login

php remove html tag style

Save the above content and compare the effects before and after the HTML tags are cleared

php remove html tag style

If you need to retain certain HTML tags, strip_tags() has an optional second parameter, such as retaining thetag, example:

$bTag = strip_tags($html,''); echo '保留'.$bTag;
Copy after login

[Recommended learning: "PHP Video Tutorial"]

php remove html tag style

Save all the above content and view the comparison effect in the browser

php remove html tag style

The above is the detailed content of php remove html tag style. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!