Home > Backend Development > PHP Tutorial > PHP function code to replace special characters in extremely long text_PHP tutorial

PHP function code to replace special characters in extremely long text_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:18:54
Original
993 people have browsed it

Copy code The code is as follows:

function unhtml($content){
$content=htmlspecialchars($content);
$content=str_replace(chr(13),"
",$content);
$content=str_replace(chr(32),"
",$content);
$ content=str_replace("[_[","<",$content);
$content=str_relace(")_)",">",$content);
$content=str_replace( "|_|","",$content);
rerurn trim($content);
}


PHP str_replace() function

Definition and Usage
str_replace() function uses a string to replace other characters in a string.

Syntax
str_replace(find,replace,string,count)
参数 描述
find 必需。规定要查找的值。
replace 必需。规定替换 find 中的值的值。
string 必需。规定被搜索的字符串。
count 可选。一个变量,对替换数进行计数。

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325441.htmlTechArticleCopy the code The code is as follows: function unhtml($content){ $content=htmlspecialchars($content); $content= str_replace(chr(13),"br",$content); $content=str_replace(chr(32),"br",$content);...
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 Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template