php如何批量替换字符串
导读
PHP批量替换字符串的方法:
str_replace 批量查找替换字符串
<?php $str = 'I Love You!'; $str = str_replace('o','O',$str,$count); echo $str.PHP_EOL; // I LOve YOu! echo '替换了'.$count.'个'.PHP_EOL; // 替换了2个 $str = 'I Love You!'; $str = str_replace(['o','u'],'O',$str,$count); echo $str.PHP_EOL; // I LOve YOO! echo '替换了'.$count.'个'.PHP_EOL; // 替换了3个
评论(0)