如果字符串中没有中文可以使用str_replace()函数替换字符串。
语法格式:
str_replace(find,replace,string,count)
参数介绍:
实例:
把字符串 "Hello world!" 中的字符 "world" 替换为 "Shanghai"
echo str_replace("world","Shanghai","Hello wor<mark style="color:transparent">来源gaodaimacom搞#^代%!码网</mark>ld!");
更多相关教程请访问搞代码。
以上就是php中的字符串替换函数是什么的详细内容,更多请关注搞代码gaodaima其它相关文章!