在 vBulletin 4 模板中替换预件


preg replace in vbulletin 4 template

我希望代码在钩子上替换 vbulletin 模板中的单词(global_start ...

VB3 中的代码

$vbulletin->templatecache['SHOWTHREAD'] = preg_replace("#word#", "replace", $vbulletin->templatecache['SHOWTHREAD']);

但我想要它用于 vbulletin 4

你应该改用str_replace:

$vbulletin->templatecache['SHOWTHREAD'] = str_replace("word", "replace", $vbulletin->templatecache['SHOWTHREAD']);