时间:2021-07-01 10:21:17 帮助过:17人阅读
$k=array("i","n"); $row="iphone"; $row = preg_replace("/($k[0])/i", "\\1", $row); $row = preg_replace("/($k[1])/i", "\\1", $row); echo $row; //输出 nt color=red>int>phone //怎么样才能让关键字也就是$k里面的字母变为红色的?不重复替换?
$k=array("i","n"); $p= join('',$k); $row="iphone"; echo preg_replace("/[".$p."]/i", "\\0", $row);