我有这个字符串:image/fewe
,我想用别的东西代替,但我不确定我要怎么做,有帮助吗?
str_replace("replace_me", "replace_with", 'image/fewe');
preg_replace() // you'll need to look that up to match your regex with your needs.
不知道你还在找什么
$string = 'image/fewe';
$replaceItWith = 'another string';
$result = str_replace('image/fewe', $replaceItWith, $string);
如果要在字符串中搜索模式,则使用preg_replace()
。