合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
[TOC] ## 替换单个 ``` $res = preg_replace("/abc/","ab-","abcdec"); print_r($res); // ab-dec ``` ## 替换多个 ``` $res1 = preg_replace(["/abc/","/dec/"],["ab-","de-"],"abcdec"); print_r($res1); // ab-de- ``` ## 用匹配的值替换 ``` $res = preg_replace("/(ab)c/",'--${1}--',"cabc"); print_r($res); // c--ab-- ```