phpbb代码更新preg_replace到preg_replace_callback

时间:2017-03-04 20:55:49

标签: php preg-replace phpbb preg-replace-callback

我无法理解新的php函数使用preg_replace_callback而不是preg_replace

我需要将以下功能转换为新格式。

非常感谢提前

$text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:$uid)\]#", ' ', $text);


preg_replace('#^([^ ]*)#', '', utf8_substr($text, $i - $sequence_length, $sequence_length));


  $match = get_preg_expression('bbcode_htm');
        $replace = array('\1', '\1', '\2', '\1', '', '');

    $message = preg_replace($match, $replace, $message);


$text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:$uid)\]#", ' ', $text);


preg_replace('/[&?]sid=[0-9a-f]{32}$/', '', preg_replace('/([&?])sid=[0-9a-f]{32}&/', '$1', $relative_url));

preg_replace($magic_url_match, $magic_url_replace, $text);
return preg_replace($censors['match'], $censors['replace'], $text);     
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text);
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $phpbb_root_path . $config['smilies_path'] . '/\2 />', $text);

0 个答案:

没有答案