preg_replace
$html = <<<html<div class="abc"><a href="hash.php?a=123" target="_blank">ca<font>s</font>d</a></div><div class="abc"><a href="hash.php?a=456" target="_blank">casd</a></div>html;preg_match_all('/<div\s*class=\"abc\">\s*<a href=\"hash\.php\?a=(.*?)\" target=\"_blank\">(?:.*?)<\/a>/i', $html, $match);foreach ($match[0] as $key => $value) { $newValue = $value."\n<img src='tr.php?hash=".$match[1][$key]."' style="max-width:90%" heigth='120' alt="preg_replace的使用问题?" >"; $html = str_replace($value, $newValue, $html);}var_dump($html);