参数参考位置:thinkphp\library\think\cache\driver class Redis extends Driver { protected $options = [ 'host' => '127.0.0.1', 'port' => 6379, 'password' => '', 'select' => 0, 'timeout' => 0, 'expire' => 0, 'persistent' => false, 'prefix' => '', ]; 方式一:控制器 public function index(){ $config = [ 'host' => '192.168.70.161', 'port' => 6379, 'password' => 'admin999', 'select' => 0, 'timeout' => 0, 'expire' => 0, 'persistent' => false, 'prefix' => '', ]; $Redis=new Redis($config); $Redis->set("test","test"); echo $Redis->get("test"); } 方式二:符合类型缓存(配置文件) config.php 'cache' => [ // 使用复合缓存类型 'type' => 'complex',