16080891(Lamp→研讨会)

处理字符串函数.....

上一篇 / 下一篇  2007-04-21 23:45:25 / 个人分类:PHP学习笔记

addslashes():将所有的引号都加上反斜扛;

stripslashes();将所有的反斜扛去消;

在显示用户数据之前,必须调用stripslashes();否则,反斜扛将被显示;

-------------------------------------分割字符串-----------------------------------------

$email_array = explode('@',$email); 其中explode()函数是将电子邮件地址分割成两部分;用户名称,它

保存在$email_array[0]中,而域名则保存在$email_array[1]中;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$test = 'Your customer service is excellent';

substr($test,1); 将返回从$test字符串中第1个位置到最后的一个位置:
                 (our customer service is excellent)
                 请注意:字符串的起点和数组一样,从0开始;
substr($test,-9); 如果为负数,将从尾部开始:(excellent);

substr($test,0,3); 将返回从$test字符串中第0个位置取3个字符;

substr($test,5,-13); 将返回从$test字符串中第4个字符到倒数第13个字符;

TAG: php学习笔记 PHP学习笔记

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar