是否可以在不破坏原始外壳的情况下运行 str_ireplace?
例如:
$txt = "Hello How Are You";
$a = "are";
$h = "hello";
$txt = str_ireplace($a, "<span style='background-color:#EEEE00'>".$a."</span>", $txt);
$txt = str_ireplace($h, "<span style='background-color:#EEEE00'>".$h."</span>", $txt);
这一切都很好,但结果输出:
[hello] How [are] You
代替:
[Hello] How [Are] You
(方括号是颜色背景)
谢谢。