$text1 =
'
123345
$pattern = '/<img src="\//i';</pre alt="一段PHP的preg_replace正则替换代码求优化更好的。谢谢大家" > </p> <p class="sougouAnswer"> <pre class="sycode" name="code">$pattern = '#<img src="/#i';</pre alt="一段PHP的preg_replace正则替换代码求优化更好的。谢谢大家" > </p> <p class="sougouAnswer"> <pre class="sycode" name="code">str_replace('src="/','src="http://www.qq.com/',$text1);
str_replace('src="/','src="http://www.qq.com/',$text1);
字符串替换要比正则至少快10倍
str_replace('src="/','src="http://www.qq.com/',$text1);