几个有用的php字符串过滤,转换函数,主要是一些字符的安全处理与字符串处理
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的第一个字母为大写
以上就是php字符串过滤与转换函数的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号