Home > Web Front-end > HTML Tutorial > How to remove html tags

How to remove html tags

coldplay.xixi
Release: 2023-01-05 16:11:26
Original
6008 people have browsed it

The way to remove html tags is to use the [strip_tags()] function to easily remove HTML and PHP tags from strings. The syntax is [trip_tags ( string $str [, string $allowable_tags ] )].

How to remove html tags

The operating environment of this tutorial: windows7 system, html5 version, DELL G3 computer.

How to remove html tags:

foreach ($list['company_list'] as $key => $value) {
$list['company_list'][$key]['summary'] =strip_tags($list['company_list'][$key]['summary']);//去除html标签
$list['company_list'][$key]['summary'] = str_replace(' ',' ', $list['company_list'][$key]['summary']);
Copy after login

Word explanation:

strip_tags()The function can easily remove HTML and PHP tags from strings.

Usage:

trip_tags ( string $str [, string $allowable_tags ] );
Copy after login

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

str_replace()Function uses a string to replace other characters in a string

Syntax

str_replace(find,replace,string,count)
Copy after login

How to remove html tags

Related learning recommendations: html video tutorial

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

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template