国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

關(guān)于supportRequest的一些疑問

dgkerry

問題描述

我嘗試在中間件中使用support\Request(不用Webman\Http\Request的原因就是想在Request類中添加自定義的方法,但又不想改變vendor里面的文件),當我use support\Request后重啟webman,卻如下錯誤,請問為何呢?support\Request是繼承Webman\Http\Request,如果我在中間件中用Webman\Http\Request替換掉support\Request卻可以,有人能解答?

##錯誤代碼
pid:1132815 Worker[1132815] process terminated with ERROR: E_COMPILE_ERROR "Declaration of
app\middleware\GolbalRequest::process(support\Request $request, callable $handler):
Webman\Http\Response must be compatible with Webman\MiddlewareInterface::process(Webman\Http\Request $request, callable $handler):
Webman\Http\Response in /www/wwwroot/testwebman.okbot.app/app/middleware/GolbalRequest.php
on line 9"

代碼

<?php
namespace app\middleware;
use Webman\MiddlewareInterface;
use Webman\Http\Response;
use Webman\Http\Request;
use Workerman\Coroutine\Context;
use diyvendor\logger\Log;
class GolbalRequest implements MiddlewareInterface{
    public function process(Request $request, callable $handler) : Response
    {
        $response = $handler($request); // 繼續(xù)向洋蔥芯穿越,直至執(zhí)行控制器得到響應
        return $response;
    }
}
?>
339 1 0
1個回答

th

自定義的方法獨立出來

  • 暫無評論
??