php替换超长文本中的特殊字符的函数代码
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函数点评
1.print_r()打印关于变量的易于理解的信息,若为数组,则显示数组的结构信息.例如:?php$a=array('a'='apple','b'='banana','c'=array('x','y','z'));print_r($a);?axgle点评:
PHP5权威编程阅读学习笔记 附电子书下载
PHP5权威编程(PHP5PowerProgramming)PDF下载地址http://www.gimoo.net/books/28207.htmlPHP4中,不使用__construct()作为构造函数的名字,必须使用类的名字定义一个方法,
PHP基础知识回顾
header("Content-Type:text/html;charset=UTF-8");$conn=mysql_connect('localhost','root','');//链接服务器(非永久性)if(!$conn){echo'hr/';die('error:'.mysql_error());}else{echo'hr/';echo'链接
编辑:广州明生医药有限公司
标签:函数,字符串,数组,变量,定义