无论这个字符串是大写还是小写,我都需要替换子字符串
$sub = "STR";
$newsub="All-";
$str="Strstring";
$newstr=str_replace($sub,$rep,$str);
最佳答案
你可以使用PHP的str_ireplace
函数作为
$sub = "STR";
$newsub="All-";
$str="Strstring";
$newstr=str_ireplace($sub,$newsub,$str);
关于php - 如何用php替换子字符串,无论它是小字符还是大字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30910756/