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 ] )].
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']);
Word explanation:
strip_tags()
The function can easily remove HTML and PHP tags from strings.
Usage:
trip_tags ( string $str [, string $allowable_tags ] );
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)
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!