我看PHP手册后试了一个出来了,不知道还有没有更好的方法   $str="{34}{48}{47}{31}dsfdadsfa{}}{}dfad{31}";   function img($matches) {
 // print_R($matches[0]);
      $matches[0]=preg_replace("/\{/","<img src=",$matches[0]);
  $matches[0]=preg_replace("/\}/",".gif>",$matches[0]);   return $matches[0];
  }print(preg_replace_callback("/\{\-?[0-9]+\}/","img",$str));