日期:2014-05-16 浏览次数:20418 次
<img src="http://www.ke6.com/wp-content/uploads/2014/02/hbzy1.jpg" alt="hbzy" width="60" height="60" class="alignnone size-full wp-image-2100" />
<div class="gif-box">
<img src="http://www.ke6.com/wp-content/uploads/2014/02/hbzy1.jpg!static" _src="http://www.ke6.com/wp-content/uploads/2014/02/hbzy1.jpg!static" class="alignnone size-full wp-image-2100" tsrc="http://www.ke6.com/wp-content/uploads/2014/02/hbzy1.jpg" width="60" height="60" />
<div class="gif-loading-box">
<i class="gif-loading" style="display:none;"></i>
<i class="gif-play"></i>
</div>
</div>
$html = <<<html
<div class="gif-box">
<img src="http://www.ke6.com/wp-content/uploads/2014/02/hbzy1.jpg" alt="hbzy" width="60" height="60" class="alignnone size-full wp-image-2100" />
<div class="gif-loading-box">
<i class="gif-loading" style="display:none;"></i>
<i class="gif-play"></i>
</div>
</div>
html;
$regImg = preg_match_all('/<img src=\"(.*?)\" alt=\"hbzy\" width=\"60\" height=\"60\" class=\"alignnone size-full wp-image-2100\" \/>/', $html, $matches) ;
$newSrc = $matches[1][0].'!static"'." _src=\"".$matches[1][0]."!static\" tsrc=\"".$matches[1][0];
$html = str_replace($matches[1][0], $newSrc, $html);
var_dump($html);