Home  >  Article  >  Backend Development  >  php替换超长文本中的特殊字符的函数代码_PHP

php替换超长文本中的特殊字符的函数代码_PHP

WBOY
WBOYOriginal
2016-06-01 12:11:26811browse
复制代码 代码如下:
function unhtml($content){
$content=htmlspecialchars($content);
$content=str_replace(chr(13),"
",$content);
$content=str_replace(chr(32),"
",$content);
$content=str_replace("[_[","$content=str_relace(")_)",">",$content);
$content=str_replace("|_|","",$content);
rerurn trim($content);
}


PHP str_replace() 函数

定义和用法
str_replace() 函数使用一个字符串替换字符串中的另一些字符。

语法
str_replace(find,replace,string,count)
参数 描述
find 必需。规定要查找的值。
replace 必需。规定替换 find 中的值的值。
string 必需。规定被搜索的字符串。
count 可选。一个变量,对替换数进行计数。
Statement:
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