Heim  >  Artikel  >  Backend-Entwicklung  >  几个有用的php字符串过滤,转换函数代码_PHP教程

几个有用的php字符串过滤,转换函数代码_PHP教程

WBOY
WBOYOriginal
2016-07-21 15:19:20864Durchsuche

nl2br();// \n to

addslashes(); stripslashes();//对数据库操作时,转义特殊字符

chop();//除去字符串右边空格
trim();//除去字符串中所有空格
ltrim();//除去字符串左边空格

htmlspecialchars();//转换'$','"',''为相应的html实体
htmlentities();//转换所有html标记为相应的html实体

array explode(string separator, string str);//分割字符串
string implode(string separator, array arr);//连接字符串

strtoupper(); strtolower();//转换大小写
ucfirst();//只转换第一个字符为大写
ucwords();//转换每个words的第一个字母为大写

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/325289.htmlTechArticlenl2br();// \n to addslashes(); stripslashes();//对数据库操作时,转义特殊字符 chop();//除去字符串右边空格 trim();//除去字符串中所有空格 ltrim();//除去...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn