安装 通过 Composer 安装 predis/predis 包(项目根目录下运行): composer require predis/predis 配置 方法一:修改 config/database.php 'redis' => [ 'client' => 'predis', 'default' => [ 'host' => env('REDIS_HOST', '127.0.0.1'), //redis连接地址 'password' => env('REDIS_PASSWORD',null), //redis密码