这属于stackoverflow。无论如何,这里有一个解决方案:
$content = preg_replace_callback(\'/\\%replaceContent:{(.*?)}\\%/\', \'do_replacements\', $content);
function do_replacements($matches){
$type = $matches[1]; // here\'s your {type}
$replacement = "...replacement for {$type}";
return $replacement;
}