【发布时间】:2013-12-18 08:34:10
【问题描述】:
我必须将字符串的一部分替换为另一部分。
原文:
src="../../Estatico//ComunesSEI/Images/Supernet_logo.gif"
我想要的结果:
src="https://empresas3.gruposantander.es/SEI_PARTENON_ENS/Estatico//ComunesSEI/Images/Supernet_logo.gif"
问题:我必须改变
src="../..
为
src="src="https://empresas3.gruposantander.es/SEI_PARTENON_ENS
【问题讨论】:
-
欢迎来到 SO!你能解释一下你尝试了什么吗?
-
我试过这个 $pattern = '/src="\/..\/..\//'; $replace = 'src="empresas3.gruposantander.es/SEI_PARTENON_ENS'; $output = preg_replace($pattern,$replace,$output);
-
也尝试转义
.。 src="\/\.\.\/\.\.\//'; -
我不明白你的意思:S 你能解释一下或举个例子吗?这!
标签: url preg-replace