Home> php教程> php手册> body text

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

WBOY
Release: 2016-06-13 09:55:56
Original
1004 people have browsed it

文章介绍了在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;

}

source:php.cn
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
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!