Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remove HTML tags

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to remove HTML tags". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

You can use the "strip_tags ()" function to remove the html tag with the syntax format of "strip_tags (string to be checked, tag that will not be deleted)". The strip_tags function strips the tags of HTML, XML, and PHP from the string, and it always strips the HTML comment.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Foreach ($list ['company_list'] as $key = > $value) {$list [' company_list'] [$key] ['summary'] = strip_tags ($list [' company_list'] [$key] ['summary']); / / remove the html tag $list [' company_list'] [$key] ['summary'] = str_replace (',', $list ['company_list'] [$key] [' summary'])

The strip_tags () function makes it easy to remove HTML and PHP tags from a string.

How to use it:

Trip_tags (string $str [, string $allowable_tags])

The first parameter is required, that is, to remove the source data of the HTML and PHP tags, and the second parameter is optional, representing tags that do not need to be filtered.

The str_replace () function replaces other characters in a string with a string.

The syntax str_replace (find,replace,string,count) parameter describes the find required. Specifies the value to look for. Replace is required. Specifies the value that replaces the value in find. String is required. Specifies the string to be searched. Count is optional. A variable that counts the number of substitutions. This is the end of "how to remove the HTML tag". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report