<kbd id="cMXop"><strong id="cMXop"></strong></kbd>

        <sub id="cMXop"><keygen id="cMXop"></keygen></sub>

          • <keygen id="cMXop"></keygen><caption id="cMXop"><output id="cMXop"><sub id="cMXop"></sub><caption id="cMXop"><option id="cMXop"></option><abbr id="cMXop"><cite id="cMXop"><i id="cMXop"></i></cite></abbr><button id="cMXop"><ruby id="cMXop"><nav id="cMXop"></nav></ruby></button></caption></output></caption>
            <aside id="cMXop"></aside>
              1. TP6 workerman运行时使用json输出错误会产生异常

                浏览:996 发布日期:2020/01/21
                5.0.0 - 致命 - 未处理
                tp6版本 使用workerman运行
                我重写了错误错误,将错误输出为json    public function render($request, Throwable $e): Response
                    {
                        // 添加自定义异常处理机制

                        // 其他错误交给系统处理
                //        return parent::render($request, $e);
                        $this->isJson = true;
                        if ($e instanceof HttpResponseException) {
                            return $e->getResponse();
                        } elseif ($e instanceof HttpException) {
                            return $this->renderHttpException($e);
                        } else {
                            return $this->convertExceptionToResponse($e);
                        }
                    }
                然后运行的命令行就会报错:InvalidArgumentException: Recursion detected in /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/response/Json.php:54
                Stack trace:
                #0 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Response.php(384): think\response\Json->output(false)
                #1 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Application.php(92): think\Response->getContent()
                #2 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Application.php(67): think\worker\Application->exception(Object(Workerman\Connection\TcpConnection), Object(InvalidArgumentException))
                #3 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Http.php(161): think\worker\Application->worker(Object(Workerman\Connection\TcpConnection), Array)
                #4 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Connection/TcpConnection.php(658): think\worker\Http->onMessage(Object(Workerman\Connection\TcpConnection), Array)
                #5 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Events/Select.php(294): Workerman\Connection\TcpConnection->baseRead(Resource id #194)
                #6 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(2382): Workerman\Events\Select->loop()
                #7 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(1490): Workerman\Worker->run()
                #8 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(1320): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
                #9 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(1294): Workerman\Worker::forkWorkersForLinux()
                #10 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(509): Workerman\Worker::forkWorkers()
                #11 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Http.php(278): Workerman\Worker::runAll()
                #12 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/command/Worker.php(135): think\worker\Http->start()
                #13 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/console/Command.php(210): think\worker\command\Worker->execute(Object(think\console\Input), Object(think\console\Output))
                #14 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Console.php(600): think\console\Command->run(Object(think\console\Input), Object(think\console\Output))
                #15 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Console.php(259): think\Console->doRunCommand(Object(think\worker\command\Worker), Object(think\console\Input), Object(think\console\Output))
                #16 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Console.php(196): think\Console->doRun(Object(think\console\Input), Object(think\console\Output))
                #17 /mnt/d/webProject/electric_energize_php_api/think(10): think\Console->run()
                #18 {main}
                Worker[24902] process terminated
                worker[thinkphp:24902] exit with status 64000
                接着客户端就会收不到任何响应。
                评论(
                后面还有条评论,点击查看>>