laravel 问题 Class 'Predis\Client' not found
刚开始使用composer 下载predis,但是下载路径不在 laravel 的vendor 下,然后运行代码时
$redis = Redis::connection(); $redis->set('name', 'Taylor'); $name = $redis->get('name'); dd($name);总是报错
Class 'Predis\Client' not found in Laravel
最后我通过在composer。json中添加在运行代码成功了。
最后得出结论: 必须在vendor目录下安装predis扩展,才可以运行以上代码。
D:\phpstudy\WWW\laravel54\vendor\laravel\framework\src\Illuminate\Redis\Connectors\PredisConnector.php 这是因为在这个文件中引用了Predis\Client,必须安装完成才会
出现这个文件。