为什么这会返回原始字符串而不是编辑后的字符串?
原始字符串:
I cant believe Ed ate [-food-] for breakfast.
代替:
preg_replace_callback('/\[\-[a-zA-Z0-9_]\-\]/', 'tag_func', $email_body);
function tag_func($matches){
$matches[0] = 'tacos';
return $matches[0];
}
结果所需的字符串:
I cant believe Ed ate tacos for breakfast.
这是我收到的警告:
preg_replace_callback(): Requires argument 2, 'tag_func', to be a valid callback