执行命令:php artisan larabbs:calculate-active-user 时,报错:Class ‘Redis’ not found
1、执行命令:php artisan larabbs:calculate-active-user 时,报错:Class ‘Redis’ not found。如图1
PS E:\wwwroot\larabbs> php artisan larabbs:calculate-active-user 开始计算... Error Class 'Redis' not found at E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Redis\Connectors\PhpRedisConnector.php:75 71▕ * @throws \LogicException 72▕ */ 73▕ protected function createClient(array $config) 74▕ { ➜ 75▕ return tap(new Redis, function ($client) use ($config) { 76▕ if ($client instanceof RedisFacade) { 77▕ throw new LogicException( 78▕ extension_loaded('redis') 79▕ ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.' • A class import is missing: You have a missing class import. Try importing this class: `Illuminate\Support\Facades\Redis`. 1 E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Redis\Connectors\PhpRedisConnector.php:28 Illuminate\Redis\Connectors\PhpRedisConnector::createClient() 2 E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Redis\Connectors\PhpRedisConnector.php:32 Illuminate\Redis\Connectors\PhpRedisConnector::Illuminate\Redis\Connectors\{closure}()
2、此命令中使用到了缓存,使用 Redis 作为缓存驱动。编辑 .dev 文件,添加:REDIS_CLIENT=predis
CACHE_DRIVER=redis REDIS_CLIENT=predis
3、再次执行命令:php artisan larabbs:calculate-active-user ,不再报错。如图2
PS E:\wwwroot\larabbs> php artisan larabbs:calculate-active-user 开始计算... 成功生成! PS E:\wwwroot\larabbs>
近期评论