根据https://www.workerman.net/doc/webman/db/redis.html 安装redis.
composer require -W webman/redis illuminate/events
安装完成后,发现
support目录没有 Redis.php这个文件 。
导致 use support\Redis; 会报错。怎么搞。
<?php
namespace app\index\controller;
use support\Request;
use support\Redis;
class Test
{
public function index(Request $request)
{
$key = 'test_key';
Redis::set($key, rand());
return response(Redis::get($key));
}
}
Error: Class "support\Redis" not found in
webman2
安装完重启一下
webman
https://github.com/webman-php/redis/blob/main/src/support/Redis.php
牛,可以用了,我翻了github好久,都没找到这个文件。
有bug 多看文档,https://www.workerman.net/doc/webman/db/redis.html
简单讲就是:webman 2版本,需要安装一个 包
composer require -W webman/redis illuminate/events