larabbs icon indicating copy to clipboard operation
larabbs copied to clipboard

Non-static method Redis::hGet() cannot be called statically

Open yes8080 opened this issue 8 years ago • 6 comments

Windows下LastActivedAtHelper的Redis路径错误 larabbs\app\Models\Traits\LastActivedAtHelper.php delete : use Redis; add : use Illuminate\Support\Facades\Redis;

yes8080 avatar Jan 27 '18 13:01 yes8080

我尝试过修改。最后提示我"Connection refused [tcp://127.0.0.1:6379]",折腾了很久,还是解决不了问题,折腾的我都进行不下去了。

Jeepin-Ann avatar May 26 '18 07:05 Jeepin-Ann

if you deploy on your own computer and use sublime text, "use Redis" in file larabbs\app\Models\Traits\LastActivedAtHelper.php has no problem. you may replace "use Redis" with "use Illuminate\Support\Facades\Redis" on the contrary if you deploy on the remote server.

LeoRoll avatar Sep 06 '18 17:09 LeoRoll

@Jeepin-Ann maybe you should change REDIS_HOST=127.0.0.1 to REDIS_HOST=redis in .env that file under your project.

LeoRoll avatar Sep 06 '18 17:09 LeoRoll

use Redis; 和 use Illuminate\Support\Facades\Redis; 有什么区别,确实解决了我的问题,但是还想问一下他俩的区别

zoulux avatar Nov 04 '18 05:11 zoulux

@zoulux 没区别,是个 alias 的关系

liyu001989 avatar Nov 04 '18 09:11 liyu001989

predis扩展与laravel redis别名的冲突,如果PHP环境安装有predis扩展,use Redis首先会寻找到根命名空间的redis扩展

tashuo avatar May 22 '19 06:05 tashuo