php替换超长文本中的特殊字符的函数代码
php替换超长文本中的特殊字符的函数代码
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:functionunhtml($content){$content=htmlspecialchars($content);...

复制代码 代码如下:

function unhtml($content){

$content=htmlspecialchars($content);

$content=str_replace(chr(13),"<br>",$content);

$content=str_replace(chr(32),"<br>",$content);

$content=str_replace("[_[","<",$content);

$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 可选。一个变量,对替换数进行计数。

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新php教程学习
热门php教程学习
编程开发子分类