Laravel 4 : Call to undefined method Redis::connection()

后端 未结 4 1038
情歌与酒
情歌与酒 2021-02-08 11:37

I\'m going crazy about this error. I\'ve got a vagrant VM with Debian 7, generated with Puphpet, installation was fine.

1. Redis is installed and working

4条回答
  •  走了就别回头了
    2021-02-08 12:13

    I came across this after encountering this issue and wanted to add another answer in case it helps someone else.

    In my case there was an alias collision because my php configuration has the PHP-Redis module/extension enabled -- both the PHP module and Laravel seem to have a conflicting object named Redis. I was able to resolve this simply by using the entire namespaced identifier:

    //$r = Redis::connection() 
    $r = Illuminate\Support\Facades\Redis::connection();
    

提交回复
热议问题