版权声明:本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可,转载时请标注 https://blog.csdn.net/qq6759/article/details/88971093
php 如何去掉一个字符串中某个字符,php 字符串删除某个字符,php 删除字符,php 字符串替换
如果没有中文的话可以用 str_replace
str_replace(find,replace,string,count) str_replace() 函数以其他字符替换字符串中的一些字符(区分大小写)
参数 | 描述 |
---|---|
find | 必需。规定要查找的值。 |
replace | 必需。规定替换 find 中的值的值。 |
string | 必需。规定被搜索的字符串。 |
count | 可选。对替换数进行计数的变量。 |
例:把字符串 "Hello world!" 中的字符 "world" 替换为 "Shanghai"
echo str_replace("world","Shanghai","Hello world!");