多个str_替换为一个字符串?PHP
例如,我需要将“This is'string.”替换为“This is'u the'u string.”。我知道如何用“"”来代替“,”但我知道如何用“?”来代替“?” 这将为您提供:多个str_替换为一个字符串?PHP,php,Php,例如,我需要将“This is'string.”替换为“This is'u the'u string.”。我知道如何用“"”来代替“,”但我知道如何用“?”来代替“?” 这将为您提供: $s = "This is the 'string'."; echo str_replace(array(" ", "'"), array("_",''), $s); 可以通过数组为$subject中的$search和$replace键接受多个参数 mixed str_replace ( mixed $se
$s = "This is the 'string'.";
echo str_replace(array(" ", "'"), array("_",''), $s);
可以通过数组为
$subject
中的$search
和$replace
键接受多个参数
mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )
尝试传入数组
输出:-此\u是\u字符串 此问题已被问了89302843907498320748392次。@expresso your welcome:)您需要接受/投票表决有用的答案。
$str = "This is the 'string'.";
echo str_replace(array("'"," "), array('', '_'), $str);