Home  >  Article  >  Backend Development  >  php回车与空格字符替换函数_PHP教程

php回车与空格字符替换函数_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:55:351048browse

文章介绍了在php开发中的一些特殊字符替换,有需要的同学可以看看。

 

// 函数名:ReplaceSpacialChar($C_char)

// 作 用:特殊字符替换函数

// 参 数:$C_char(待替换的字符串)

// 返回值:字符串

// 备 注:这个函数有问题,需要测试才能使用

//-----------------------------------------------------------------------------------

 代码如下 复制代码


function ReplaceSpecialChar($C_char)

{

$C_char=HTMLSpecialChars($C_char); //将特殊字元转成 HTML 格式。

$C_char=nl2br($C_char); //将回车替换为

$C_char=str_replace(" "," ",$C_char); //替换空格为

return $C_char;

}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632241.htmlTechArticle文章介绍了在php开发中的一些特殊字符替换,有需要的同学可以看看。 // 函数名:ReplaceSpacialChar($C_char) // 作 用:特殊字符替换函数 // 参...
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