ArgumentCountError: Too few arguments to function Workerman\Protocols\Http\Request::__construct(),
<?php
namespace plugin\wekbbs\app\controller;
use support\Request;
use support\Response;
use Webman\Captcha\CaptchaBuilder;
class ImageController
{
// /app/wekbbs/ImageController/loginCaptcha
public function loginCaptcha(): Response
{
$request = new Request();
var_dump($request);
// // 初始化验证码类
$builder = new CaptchaBuilder;
// 生成验证码
$builder->build();
// 将验证码的值存储到session中
$request->session()->set('captcha', strtolower($builder->getPhrase()));
// 获得验证码图片二进制数据
$img_content = $builder->get();
// 输出验证码二进制数据
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
}
}
ArgumentCountError: Too few arguments to function Workerman\Protocols\Http\Request::__construct(), 0 passed in E:\gitee\wekbbs\plugin\wekbbs\app\controller\ImageController.php on line 18 and exactly 1 expected in E:\gitee\wekbbs\vendor\workerman\workerman\Protocols\Http\Request.php:80
Stack trace:
#0 E:\gitee\wekbbs\plugin\wekbbs\app\controller\ImageController.php(18): Workerman\Protocols\Http\Request->__construct()
#1 E:\gitee\wekbbs\vendor\workerman\webman-framework\src\App.php(325): plugin\wekbbs\app\controller\ImageController->loginCaptcha(Object(support\Request))
#2 E:\gitee\wekbbs\vendor\workerman\webman-framework\src\App.php(141): Webman\App::Webman\{closure}(Object(support\Request))
#3 E:\gitee\wekbbs\vendor\workerman\workerman\Connection\TcpConnection.php(646): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
#4 E:\gitee\wekbbs\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead(Resource id #345)
#5 E:\gitee\wekbbs\vendor\workerman\workerman\Worker.php(1479): Workerman\Events\Select->loop()
#6 E:\gitee\wekbbs\vendor\workerman\workerman\Worker.php(1399): Workerman\Worker::forkWorkersForWindows()
#7 E:\gitee\wekbbs\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers()
#8 E:\gitee\wekbbs\vendor\workerman\webman-framework\src\support\App.php(131): Workerman\Worker::runAll()
#9 E:\gitee\wekbbs\start.php(4): support\App::run()
#10 {main}
windows下新版webman
他的类不能直接继承用,