![图片[1]-Object Cache Pro 插件 1.24 版本-牧鸭人博客](https://img.muyaren.com/wp-content/uploads/2025/06/20250618211630398-1024x814.png)
配置方法
在 wp-config.php
中添加:
define('WP_REDIS_CONFIG', [
'token' => 'e279430effe043b8c17d3f3c751c4c0846bc70c97f0eaaea766b4079001c',
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0, // change for each site
'maxttl' => 3600 * 24 * 7, // 7 days
'timeout' => 1.0,
'read_timeout' => 1.0,
'prefetch' => true,
'split_alloptions' => true,
'strict' => true,
'debug' => false,
]);
define('WP_REDIS_DISABLED', false);
常见问题
1.fnmatch() 报错,解决方案
可以在插件代码里添加一个兼容函数,以此解决 fnmatch()
未定义的问题
// 在 wp-config.php 文件中添加以下兼容函数
if (!function_exists('fnmatch')) {
function fnmatch($pattern, $string) {
return @preg_match(
'/^' . strtr(preg_quote($pattern, '/'), array(
'\*' => '.*',
'\?' => '.',
'\[' => '[',
'\]' => ']',
)) . '$/i', $string
) !== false;
}
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容