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

max/var_dump,自定義異常處理。正式環(huán)境要怎么用。。

wybwsk

問題描述

這是業(yè)務代碼。

public function test(): Response {
    try {
        d(123);
        return response('hello webman');
    } catch (Exception $e) {
        throw new BusinessException($e->getMessage());
    }
}

這是自定義的異常處理。

class ApiExceptionHandler extends Handler {
    use AbortHandler;

    public function render(Request $request, Throwable $exception): Response {
        if ($exception instanceof Abort) {
            return \response($this->convertToHtml($exception));
        }
        if ($exception instanceof BusinessException) {
            return \response('asdfasdf');
        }
        return parent::render($request, $exception);
    }
}

本意是想在index中打印一下參數(shù)到頁面上調(diào)試。。
但是插件是通過異常拋出的寫法,這樣d(123)被拋到BusinessException去了,而不是Abort。

所以。是不是說開發(fā)環(huán)境調(diào)試的時,要把try{}catch{}注掉。。
生產(chǎn)環(huán)境時,不要用d,就用print_r,在命令行顯示,不影響頁面?
但是這里我想要中斷,調(diào)試時,不執(zhí)行后面的代碼,直接拋出。這個要怎么弄?

1219 1 0
1個回答

又有心跳

return

年代過于久遠,無法發(fā)表回答
??