gpt4 book ai didi

php - 当我尝试在我的项目 laravel 6.x 上使用 redis 时,它显示此错误消息

转载 作者:行者123 更新时间:2023-12-02 13:58:42 25 4
gpt4 key购买 nike

错误:

Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension

image

我将此代码放在我的 cache.php

'default' => env('CACHE_DRIVER', 'redis'),

我的 Controller 中的那些代码:

$data['posts']   = cache('posts',function(){
Post::with('user')
->select('title', 'created_at', 'user_id', 'thumbnail_path', 'content')
->orderBy('created_at','desc')
->take(50)
->get();
});

最佳答案

首先,您需要通过在终端中运行以下命令来确保您实际上已经使用 Composer 安装了 predis: Composer 需要 predis/predis

然后你需要确保你的 .env 文件中有这个设置REDIS_CLIENT=predis

文档中对此进行了介绍: https://laravel.com/docs/6.x/redis

关于php - 当我尝试在我的项目 laravel 6.x 上使用 redis 时,它显示此错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58354628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com