phar 打包后,redis 配置密码认证默认值传 null 会报错

leesin

redis 配置改成 dotenv 获取配置的话,密码认证默认值传 null 会报错, 需要改成空字符串

return [
    'default' => [
        'host' => getenv('redis_host', '127.0.0.1'),
        'password' => getenv('redis_password', ''),
        'port' => getenv('redis_port', 6379),
        'database' => getenv('redis_database', 0),
    ],
];

下边是错误:

ErrorException: getenv(): Passing null to parameter #2 ($local_only) of type bool is deprecated in phar:///mnt/e/*/*/build/*.phar/config/redis.php:18
575 1 0
1个回答

mosquito

你看看这个函数的使用说明就知道了
https://www.php.net/manual/en/function.getenv.php

年代过于久远,无法发表回答
🔝