欢迎光临
我们一直在努力

[mcj]WordPress插件crayon-syntax-highlighter出现invalid range错误

华为学生服务器每月仅需9元!

今天在测试站点发现一个问题,网站头满屏的:

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /www/wwwroot/www.machunjie.com/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /www/wwwroot/www.machunjie.com/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /www/wwwroot/www.machunjie.com/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

有点奇怪,主站就没事,找到文件查看:

	// Override
	function clean_id($id) {
        $id = CrayonUtil::space_to_hyphen( strtolower(trim($id)) );

        return preg_replace('/[^\w-+#]/msi', '', $id);
	}

找到报错的这一行,将return preg_replace('/[^\w-+#]/msi', '', $id);改为return preg_replace('/\[^\w-+#]/msi', '', $id);

如果你对这篇文章有什么疑问或建议,欢迎下面留言提出,我看到会立刻回复!

打赏
未经允许不得转载:马春杰杰 » [mcj]WordPress插件crayon-syntax-highlighter出现invalid range错误
华为学生服务器每月仅需9元!

留个评论吧~ 抢沙发 评论前登陆可免验证码!

私密评论

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址(选填,便于回访^_^)
切换注册

登录

忘记密码 ?

切换登录

注册