doudaifu6083
2019-06-10 19:17PHP警告:preg_replace_callback():需要参数2 [重复]
This question already has an answer here:
I've been getting 503 errors on my Wordpress website. I turned on debug mode and this is what showed up:
PHP Warning: preg_replace_callback(): Requires argument 2, 'stripslashes(strstr("\2\5","rel=\class=") ? "\1" : "<a\2href=\"\3\4\"\5 rel=\"colorbox\" class=\"colorbox\"><img")', to be a valid callback
Here is the code it's referring to:
function ace_colorbox_replace($string) {
$pattern = '/(<a(.*?)href="([^"]*.)'.IMAGE_FILETYPE.'"(.*?)><img)/i';
$replacement = 'stripslashes(strstr("\2\5","rel=\class=") ? "\1" : "
<a\2href=\"\3\4\"\5 rel=\"colorbox\" class=\"colorbox\"><img")';
return preg_replace_callback($pattern, $replacement, $string);
}
I know there's some outdated code that I did update a while back... But now it's having this error. I'm not too familiar with simple PHP, but I have some experience. This is out of my comfort zone... Any help is appreciated.
</div>
- 点赞
- 回答
- 收藏
- 复制链接分享
0条回答
为你推荐
- 如何隐藏PHPMailer警告消息
- php
- 1个回答
- 警告:preg_replace_callback():需要参数2,才能成为有效的回调
- wordpress
- php
- 1个回答