Home  >  Article  >  Backend Development  >  一段PHP的preg_replace正则替换代码求优化更好的。多谢大家

一段PHP的preg_replace正则替换代码求优化更好的。多谢大家

WBOY
WBOYOriginal
2016-06-13 12:01:54675browse

一段PHP的preg_replace正则替换代码求优化更好的。谢谢大家
$text1 = 
'

123345




  •     一段PHP的preg_replace正则替换代码求优化更好的。多谢大家


  •     一段PHP的preg_replace正则替换代码求优化更好的。多谢大家


  •     一段PHP的preg_replace正则替换代码求优化更好的。多谢大家


  •     一段PHP的preg_replace正则替换代码求优化更好的。多谢大家


';

$test2 = '一段PHP的preg_replace正则替换代码求优化更好的。多谢大家$pattern = '/一段PHP的preg_replace正则替换代码求优化更好的。多谢大家echo preg_replace($pattern, $test2, $text1);

我用了$pattern = '/一段PHP的preg_replace正则替换代码求优化更好的。多谢大家感觉不是最好的方法,各位高手帮我优化下谢谢
------解决方案--------------------
<br />$pattern = '/<img  src="\//i';<br / alt="一段PHP的preg_replace正则替换代码求优化更好的。多谢大家" >

------解决方案--------------------
$pattern = '#<img  src="/#i';</pre alt="一段PHP的preg_replace正则替换代码求优化更好的。多谢大家" ><br><font color="#FF8000">------解决方案--------------------</font><br><pre class="brush: php"><br /><br />str_replace('src="/','src="http://www.qq.com/',$text1);<br /><br />
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn