think \ exception \ HttpException
controller not exists:app\index\controller\New think\exception\HttpException thrown with message "controller not exists:app\index\controller\New" Stacktrace: #27 think\exception\HttpException in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/route/dispatch/Controller.php:76 #26 think\route\dispatch\Controller:exec in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/route/Dispatch.php:96 #25 think\route\Dispatch:run in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Route.php:747 #24 think\Route:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:59 #23 think\Pipeline:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:65 #22 think\Pipeline:then in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Route.php:748 #21 think\Route:dispatch in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php:213 #20 think\Http:dispatchToRoute in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php:203 #19 think\Http:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:59 #18 think\Pipeline:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/middleware/SessionInit.php:67 #17 think\middleware\SessionInit:handle in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php:142 #16 call_user_func in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php:142 #15 think\Middleware:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:84 #14 think\Pipeline:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/think-trace/src/TraceDebug.php:71 #13 think\trace\TraceDebug:handle in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php:142 #12 call_user_func in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php:142 #11 think\Middleware:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:84 #10 think\Pipeline:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/think-multi-app/src/MultiApp.php:71 #9 think\app\MultiApp:think\app\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:59 #8 think\Pipeline:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:65 #7 think\Pipeline:then in /www/wwwroot/www.startup-4.com/vendor/topthink/think-multi-app/src/MultiApp.php:72 #6 think\app\MultiApp:handle in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php:142 #5 call_user_func in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php:142 #4 think\Middleware:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:84 #3 think\Pipeline:think\{closure} in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php:65 #2 think\Pipeline:then in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php:204 #1 think\Http:runWithRequest in /www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php:162 #0 think\Http:run in /www/wwwroot/www.startup-4.com/index.php:20
Stack frames (28)
27
think\exception\HttpException
/vendor/topthink/framework/src/think/route/dispatch/Controller.php76
26
think\route\dispatch\Controller exec
/vendor/topthink/framework/src/think/route/Dispatch.php96
25
think\route\Dispatch run
/vendor/topthink/framework/src/think/Route.php747
24
think\Route think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php59
23
think\Pipeline think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php65
22
think\Pipeline then
/vendor/topthink/framework/src/think/Route.php748
21
think\Route dispatch
/vendor/topthink/framework/src/think/Http.php213
20
think\Http dispatchToRoute
/vendor/topthink/framework/src/think/Http.php203
19
think\Http think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php59
18
think\Pipeline think\{closure}
/vendor/topthink/framework/src/think/middleware/SessionInit.php67
17
think\middleware\SessionInit handle
/vendor/topthink/framework/src/think/Middleware.php142
16
call_user_func
/vendor/topthink/framework/src/think/Middleware.php142
15
think\Middleware think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php84
14
think\Pipeline think\{closure}
/vendor/topthink/think-trace/src/TraceDebug.php71
13
think\trace\TraceDebug handle
/vendor/topthink/framework/src/think/Middleware.php142
12
call_user_func
/vendor/topthink/framework/src/think/Middleware.php142
11
think\Middleware think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php84
10
think\Pipeline think\{closure}
/vendor/topthink/think-multi-app/src/MultiApp.php71
9
think\app\MultiApp think\app\{closure}
/vendor/topthink/framework/src/think/Pipeline.php59
8
think\Pipeline think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php65
7
think\Pipeline then
/vendor/topthink/think-multi-app/src/MultiApp.php72
6
think\app\MultiApp handle
/vendor/topthink/framework/src/think/Middleware.php142
5
call_user_func
/vendor/topthink/framework/src/think/Middleware.php142
4
think\Middleware think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php84
3
think\Pipeline think\{closure}
/vendor/topthink/framework/src/think/Pipeline.php65
2
think\Pipeline then
/vendor/topthink/framework/src/think/Http.php204
1
think\Http runWithRequest
/vendor/topthink/framework/src/think/Http.php162
0
think\Http run
/index.php20
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/route/dispatch/Controller.php
        } else {
            $this->controller = Str::studly($controller);
        }

        // 获取操作名
        $this->actionName = strip_tags($result[1] ?: $this->rule->config('default_action'));

        // 设置当前请求的控制器、操作
        $this->request
            ->setController($this->controller)
            ->setAction($this->actionName);
    }

    public function exec()
    {
        try {
            // 实例化控制器
            $instance = $this->controller($this->controller);
        } catch (ClassNotFoundException $e) {
            throw new HttpException(404, 'controller not exists:' . $e->getClass());
        }

        // 注册控制器中间件
        $this->registerControllerMiddleware($instance);

        return $this->app->middleware->pipeline('controller')
            ->send($this->request)
            ->then(function () use ($instance) {
                // 获取当前操作名
                $suffix = $this->rule->config('action_suffix');
                $action = $this->actionName . $suffix;

                if (is_callable([$instance, $action])) {
                    $vars = $this->request->param();
                    try {
                        $reflect = new ReflectionMethod($instance, $action);
                        // 严格获取当前操作方法名
                        $actionName = $reflect->getName();
                        if ($suffix) {
                            $actionName = substr($actionName, 0, -strlen($suffix));
Arguments
  1. "controller not exists:app\index\controller\New"
    
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/route/Dispatch.php
    }

    /**
     * 执行路由调度
     * @access public
     * @return mixed
     */
    public function run(): Response
    {
        if ($this->rule instanceof RuleItem && $this->request->method() == 'OPTIONS' && $this->rule->isAutoOptions()) {
            $rules = $this->rule->getRouter()->getRule($this->rule->getRule());
            $allow = [];
            foreach ($rules as $item) {
                $allow[] = strtoupper($item->getMethod());
            }

            return Response::create('', 'html', 204)->header(['Allow' => implode(', ', $allow)]);
        }

        $data = $this->exec();
        return $this->autoResponse($data);
    }

    protected function autoResponse($data): Response
    {
        if ($data instanceof Response) {
            $response = $data;
        } elseif (!is_null($data)) {
            // 默认自动识别响应输出类型
            $type     = $this->request->isJson() ? 'json' : 'html';
            $response = Response::create($data, $type);
        } else {
            $data = ob_get_clean();

            $content  = false === $data ? '' : $data;
            $status   = '' === $content && $this->request->isJson() ? 204 : 200;
            $response = Response::create($content, 'html', $status);
        }

        return $response;
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Route.php
    public function dispatch(Request $request, $withRoute = null)
    {
        $this->request = $request;
        $this->host    = $this->request->host(true);
        $this->init();

        if ($withRoute) {
            //加载路由
            $withRoute();
            $dispatch = $this->check();
        } else {
            $dispatch = $this->url($this->path());
        }

        $dispatch->init($this->app);

        return $this->app->middleware->pipeline('route')
            ->send($request)
            ->then(function () use ($dispatch) {
                return $dispatch->run();
            });
    }

    /**
     * 检测URL路由
     * @access public
     * @return Dispatch
     * @throws RouteNotFoundException
     */
    public function check(): Dispatch
    {
        // 自动检测域名路由
        $url = str_replace($this->config['pathinfo_depr'], '|', $this->path());

        $completeMatch = $this->config['route_complete_match'];

        $result = $this->checkDomain()->check($this->request, $url, $completeMatch);

        if (false === $result && !empty($this->cross)) {
            // 检测跨域路由
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
     */
    public function through($pipes)
    {
        $this->pipes = is_array($pipes) ? $pipes : func_get_args();
        return $this;
    }

    /**
     * 执行
     * @param Closure $destination
     * @return mixed
     */
    public function then(Closure $destination)
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes),
            $this->carry(),
            function ($passable) use ($destination) {
                try {
                    return $destination($passable);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            });

        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
    /**
     * 执行
     * @param Closure $destination
     * @return mixed
     */
    public function then(Closure $destination)
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes),
            $this->carry(),
            function ($passable) use ($destination) {
                try {
                    return $destination($passable);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            });

        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
    {
        return function ($stack, $pipe) {
            return function ($passable) use ($stack, $pipe) {
                try {
                    return $pipe($passable, $stack);
                } catch (Throwable | Exception $e) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Route.php
    {
        $this->request = $request;
        $this->host    = $this->request->host(true);
        $this->init();

        if ($withRoute) {
            //加载路由
            $withRoute();
            $dispatch = $this->check();
        } else {
            $dispatch = $this->url($this->path());
        }

        $dispatch->init($this->app);

        return $this->app->middleware->pipeline('route')
            ->send($request)
            ->then(function () use ($dispatch) {
                return $dispatch->run();
            });
    }

    /**
     * 检测URL路由
     * @access public
     * @return Dispatch
     * @throws RouteNotFoundException
     */
    public function check(): Dispatch
    {
        // 自动检测域名路由
        $url = str_replace($this->config['pathinfo_depr'], '|', $this->path());

        $completeMatch = $this->config['route_complete_match'];

        $result = $this->checkDomain()->check($this->request, $url, $completeMatch);

        if (false === $result && !empty($this->cross)) {
            // 检测跨域路由
            $result = $this->cross->check($this->request, $url, $completeMatch);
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php
        // 设置开启事件机制
        $this->app->event->withEvent($this->app->config->get('app.with_event', true));

        // 监听HttpRun
        $this->app->event->trigger(HttpRun::class);

        return $this->app->middleware->pipeline()
            ->send($request)
            ->then(function ($request) {
                return $this->dispatchToRoute($request);
            });
    }

    protected function dispatchToRoute($request)
    {
        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
            $this->loadRoutes();
        } : null;

        return $this->app->route->dispatch($request, $withRoute);
    }

    /**
     * 加载全局中间件
     */
    protected function loadMiddleware(): void
    {
        if (is_file($this->app->getBasePath() . 'middleware.php')) {
            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
        }
    }

    /**
     * 加载路由
     * @access protected
     * @return void
     */
    protected function loadRoutes(): void
    {
        // 加载路由定义
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php
     * @param Request $request
     * @return mixed
     */
    protected function runWithRequest(Request $request)
    {
        $this->initialize();

        // 加载全局中间件
        $this->loadMiddleware();

        // 设置开启事件机制
        $this->app->event->withEvent($this->app->config->get('app.with_event', true));

        // 监听HttpRun
        $this->app->event->trigger(HttpRun::class);

        return $this->app->middleware->pipeline()
            ->send($request)
            ->then(function ($request) {
                return $this->dispatchToRoute($request);
            });
    }

    protected function dispatchToRoute($request)
    {
        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
            $this->loadRoutes();
        } : null;

        return $this->app->route->dispatch($request, $withRoute);
    }

    /**
     * 加载全局中间件
     */
    protected function loadMiddleware(): void
    {
        if (is_file($this->app->getBasePath() . 'middleware.php')) {
            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
        }
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
     */
    public function through($pipes)
    {
        $this->pipes = is_array($pipes) ? $pipes : func_get_args();
        return $this;
    }

    /**
     * 执行
     * @param Closure $destination
     * @return mixed
     */
    public function then(Closure $destination)
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes),
            $this->carry(),
            function ($passable) use ($destination) {
                try {
                    return $destination($passable);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            });

        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/middleware/SessionInit.php
        // Session初始化
        $varSessionId = $this->app->config->get('session.var_session_id');
        $cookieName   = $this->session->getName();
        //echo 555;exit;
        if ($varSessionId && $request->request($varSessionId)) {
            $sessionId = $request->request($varSessionId);
        } else {
            $sessionId = $request->cookie($cookieName);
        }

        if ($sessionId) {
            $this->session->setId($sessionId);
        }

        $this->session->init();

        $request->withSession($this->session);

        /** @var Response $response */
        $response = $next($request);

        $response->setSession($this->session);

        $this->app->cookie->set($cookieName, $this->session->getId());

        return $response;
    }

    public function end(Response $response)
    {
        $this->session->save();
    }
}
 
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php
    {
        return $this->queue[$type] ?? [];
    }

    /**
     * 调度管道
     * @access public
     * @param string $type 中间件类型
     * @return Pipeline
     */
    public function pipeline(string $type = 'global')
    {
        return (new Pipeline())
            ->through(array_map(function ($middleware) {
                return function ($request, $next) use ($middleware) {
                    [$call, $params] = $middleware;
                    if (is_array($call) && is_string($call[0])) {
                        $call = [$this->app->make($call[0]), $call[1]];
                    }
                    $response = call_user_func($call, $request, $next, ...$params);

                    if (!$response instanceof Response) {
                        throw new LogicException('The middleware must return Response instance');
                    }
                    return $response;
                };
            }, $this->sortMiddleware($this->queue[$type] ?? [])))
            ->whenException([$this, 'handleException']);
    }

    /**
     * 结束调度
     * @param Response $response
     */
    public function end(Response $response)
    {
        foreach ($this->queue as $queue) {
            foreach ($queue as $middleware) {
                [$call] = $middleware;
                if (is_array($call) && is_string($call[0])) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php
    {
        return $this->queue[$type] ?? [];
    }

    /**
     * 调度管道
     * @access public
     * @param string $type 中间件类型
     * @return Pipeline
     */
    public function pipeline(string $type = 'global')
    {
        return (new Pipeline())
            ->through(array_map(function ($middleware) {
                return function ($request, $next) use ($middleware) {
                    [$call, $params] = $middleware;
                    if (is_array($call) && is_string($call[0])) {
                        $call = [$this->app->make($call[0]), $call[1]];
                    }
                    $response = call_user_func($call, $request, $next, ...$params);

                    if (!$response instanceof Response) {
                        throw new LogicException('The middleware must return Response instance');
                    }
                    return $response;
                };
            }, $this->sortMiddleware($this->queue[$type] ?? [])))
            ->whenException([$this, 'handleException']);
    }

    /**
     * 结束调度
     * @param Response $response
     */
    public function end(Response $response)
    {
        foreach ($this->queue as $queue) {
            foreach ($queue as $middleware) {
                [$call] = $middleware;
                if (is_array($call) && is_string($call[0])) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
    {
        return function ($stack, $pipe) {
            return function ($passable) use ($stack, $pipe) {
                try {
                    return $pipe($passable, $stack);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            };
        };
    }

    /**
     * 异常处理
     * @param $passable
     * @param $e
     * @return mixed
     */
    protected function handleException($passable, Throwable $e)
    {
        if ($this->exceptionHandler) {
            return call_user_func($this->exceptionHandler, $passable, $e);
        }
        throw $e;
    }
/www/wwwroot/www.startup-4.com/vendor/topthink/think-trace/src/TraceDebug.php
     * @access public
     * @param Request $request
     * @param Closure $next
     * @return void
     */
    public function handle($request, Closure $next)
    {
        $debug = $this->app->isDebug();

        // 注册日志监听
        if ($debug) {
            $this->log = [];
            $this->app->event->listen(LogWrite::class, function ($event) {
                if (empty($this->config['channel']) || $this->config['channel'] == $event->channel) {
                    $this->log = array_merge_recursive($this->log, $event->log);
                }
            });
        }

        $response = $next($request);

        // Trace调试注入
        if ($debug) {
            $data = $response->getContent();
            $this->traceDebug($response, $data);
            $response->content($data);
        }

        return $response;
    }

    public function traceDebug(Response $response, &$content)
    {
        $config = $this->config;
        $type   = $config['type'] ?? 'Html';

        unset($config['type']);

        $trace = App::factory($type, '\\think\\trace\\', $config);

/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php
    {
        return $this->queue[$type] ?? [];
    }

    /**
     * 调度管道
     * @access public
     * @param string $type 中间件类型
     * @return Pipeline
     */
    public function pipeline(string $type = 'global')
    {
        return (new Pipeline())
            ->through(array_map(function ($middleware) {
                return function ($request, $next) use ($middleware) {
                    [$call, $params] = $middleware;
                    if (is_array($call) && is_string($call[0])) {
                        $call = [$this->app->make($call[0]), $call[1]];
                    }
                    $response = call_user_func($call, $request, $next, ...$params);

                    if (!$response instanceof Response) {
                        throw new LogicException('The middleware must return Response instance');
                    }
                    return $response;
                };
            }, $this->sortMiddleware($this->queue[$type] ?? [])))
            ->whenException([$this, 'handleException']);
    }

    /**
     * 结束调度
     * @param Response $response
     */
    public function end(Response $response)
    {
        foreach ($this->queue as $queue) {
            foreach ($queue as $middleware) {
                [$call] = $middleware;
                if (is_array($call) && is_string($call[0])) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php
    {
        return $this->queue[$type] ?? [];
    }

    /**
     * 调度管道
     * @access public
     * @param string $type 中间件类型
     * @return Pipeline
     */
    public function pipeline(string $type = 'global')
    {
        return (new Pipeline())
            ->through(array_map(function ($middleware) {
                return function ($request, $next) use ($middleware) {
                    [$call, $params] = $middleware;
                    if (is_array($call) && is_string($call[0])) {
                        $call = [$this->app->make($call[0]), $call[1]];
                    }
                    $response = call_user_func($call, $request, $next, ...$params);

                    if (!$response instanceof Response) {
                        throw new LogicException('The middleware must return Response instance');
                    }
                    return $response;
                };
            }, $this->sortMiddleware($this->queue[$type] ?? [])))
            ->whenException([$this, 'handleException']);
    }

    /**
     * 结束调度
     * @param Response $response
     */
    public function end(Response $response)
    {
        foreach ($this->queue as $queue) {
            foreach ($queue as $middleware) {
                [$call] = $middleware;
                if (is_array($call) && is_string($call[0])) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
    {
        return function ($stack, $pipe) {
            return function ($passable) use ($stack, $pipe) {
                try {
                    return $pipe($passable, $stack);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            };
        };
    }

    /**
     * 异常处理
     * @param $passable
     * @param $e
     * @return mixed
     */
    protected function handleException($passable, Throwable $e)
    {
        if ($this->exceptionHandler) {
            return call_user_func($this->exceptionHandler, $passable, $e);
        }
        throw $e;
    }
/www/wwwroot/www.startup-4.com/vendor/topthink/think-multi-app/src/MultiApp.php
        $this->path = $this->app->http->getPath();
    }

    /**
     * 多应用解析
     * @access public
     * @param Request $request
     * @param Closure $next
     * @return Response
     */
    public function handle($request, Closure $next)
    {
        if (!$this->parseMultiApp()) {
            return $next($request);
        }

        return $this->app->middleware->pipeline('app')
            ->send($request)
            ->then(function ($request) use ($next) {
                return $next($request);
            });
    }

    /**
     * 获取路由目录
     * @access protected
     * @return string
     */
    protected function getRoutePath(): string
    {
        if (is_dir($this->app->getAppPath() . 'route')) {
            return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR;
        }

        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $this->appName . DIRECTORY_SEPARATOR;
    }

    /**
     * 解析多应用
     * @return bool
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
     */
    public function through($pipes)
    {
        $this->pipes = is_array($pipes) ? $pipes : func_get_args();
        return $this;
    }

    /**
     * 执行
     * @param Closure $destination
     * @return mixed
     */
    public function then(Closure $destination)
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes),
            $this->carry(),
            function ($passable) use ($destination) {
                try {
                    return $destination($passable);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            });

        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
    /**
     * 执行
     * @param Closure $destination
     * @return mixed
     */
    public function then(Closure $destination)
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes),
            $this->carry(),
            function ($passable) use ($destination) {
                try {
                    return $destination($passable);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            });

        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
    {
        return function ($stack, $pipe) {
            return function ($passable) use ($stack, $pipe) {
                try {
                    return $pipe($passable, $stack);
                } catch (Throwable | Exception $e) {
/www/wwwroot/www.startup-4.com/vendor/topthink/think-multi-app/src/MultiApp.php
    }

    /**
     * 多应用解析
     * @access public
     * @param Request $request
     * @param Closure $next
     * @return Response
     */
    public function handle($request, Closure $next)
    {
        if (!$this->parseMultiApp()) {
            return $next($request);
        }

        return $this->app->middleware->pipeline('app')
            ->send($request)
            ->then(function ($request) use ($next) {
                return $next($request);
            });
    }

    /**
     * 获取路由目录
     * @access protected
     * @return string
     */
    protected function getRoutePath(): string
    {
        if (is_dir($this->app->getAppPath() . 'route')) {
            return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR;
        }

        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $this->appName . DIRECTORY_SEPARATOR;
    }

    /**
     * 解析多应用
     * @return bool
     */
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php
    {
        return $this->queue[$type] ?? [];
    }

    /**
     * 调度管道
     * @access public
     * @param string $type 中间件类型
     * @return Pipeline
     */
    public function pipeline(string $type = 'global')
    {
        return (new Pipeline())
            ->through(array_map(function ($middleware) {
                return function ($request, $next) use ($middleware) {
                    [$call, $params] = $middleware;
                    if (is_array($call) && is_string($call[0])) {
                        $call = [$this->app->make($call[0]), $call[1]];
                    }
                    $response = call_user_func($call, $request, $next, ...$params);

                    if (!$response instanceof Response) {
                        throw new LogicException('The middleware must return Response instance');
                    }
                    return $response;
                };
            }, $this->sortMiddleware($this->queue[$type] ?? [])))
            ->whenException([$this, 'handleException']);
    }

    /**
     * 结束调度
     * @param Response $response
     */
    public function end(Response $response)
    {
        foreach ($this->queue as $queue) {
            foreach ($queue as $middleware) {
                [$call] = $middleware;
                if (is_array($call) && is_string($call[0])) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Middleware.php
    {
        return $this->queue[$type] ?? [];
    }

    /**
     * 调度管道
     * @access public
     * @param string $type 中间件类型
     * @return Pipeline
     */
    public function pipeline(string $type = 'global')
    {
        return (new Pipeline())
            ->through(array_map(function ($middleware) {
                return function ($request, $next) use ($middleware) {
                    [$call, $params] = $middleware;
                    if (is_array($call) && is_string($call[0])) {
                        $call = [$this->app->make($call[0]), $call[1]];
                    }
                    $response = call_user_func($call, $request, $next, ...$params);

                    if (!$response instanceof Response) {
                        throw new LogicException('The middleware must return Response instance');
                    }
                    return $response;
                };
            }, $this->sortMiddleware($this->queue[$type] ?? [])))
            ->whenException([$this, 'handleException']);
    }

    /**
     * 结束调度
     * @param Response $response
     */
    public function end(Response $response)
    {
        foreach ($this->queue as $queue) {
            foreach ($queue as $middleware) {
                [$call] = $middleware;
                if (is_array($call) && is_string($call[0])) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
    {
        return function ($stack, $pipe) {
            return function ($passable) use ($stack, $pipe) {
                try {
                    return $pipe($passable, $stack);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            };
        };
    }

    /**
     * 异常处理
     * @param $passable
     * @param $e
     * @return mixed
     */
    protected function handleException($passable, Throwable $e)
    {
        if ($this->exceptionHandler) {
            return call_user_func($this->exceptionHandler, $passable, $e);
        }
        throw $e;
    }
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Pipeline.php
    /**
     * 执行
     * @param Closure $destination
     * @return mixed
     */
    public function then(Closure $destination)
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes),
            $this->carry(),
            function ($passable) use ($destination) {
                try {
                    return $destination($passable);
                } catch (Throwable | Exception $e) {
                    return $this->handleException($passable, $e);
                }
            });

        return $pipeline($this->passable);
    }

    /**
     * 设置异常处理器
     * @param callable $handler
     * @return $this
     */
    public function whenException($handler)
    {
        $this->exceptionHandler = $handler;
        return $this;
    }

    protected function carry()
    {
        return function ($stack, $pipe) {
            return function ($passable) use ($stack, $pipe) {
                try {
                    return $pipe($passable, $stack);
                } catch (Throwable | Exception $e) {
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php
     * @return mixed
     */
    protected function runWithRequest(Request $request)
    {
        $this->initialize();

        // 加载全局中间件
        $this->loadMiddleware();

        // 设置开启事件机制
        $this->app->event->withEvent($this->app->config->get('app.with_event', true));

        // 监听HttpRun
        $this->app->event->trigger(HttpRun::class);

        return $this->app->middleware->pipeline()
            ->send($request)
            ->then(function ($request) {
                return $this->dispatchToRoute($request);
            });
    }

    protected function dispatchToRoute($request)
    {
        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
            $this->loadRoutes();
        } : null;

        return $this->app->route->dispatch($request, $withRoute);
    }

    /**
     * 加载全局中间件
     */
    protected function loadMiddleware(): void
    {
        if (is_file($this->app->getBasePath() . 'middleware.php')) {
            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
        }
    }
/www/wwwroot/www.startup-4.com/vendor/topthink/framework/src/think/Http.php
     */
    public function isBind(): bool
    {
        return $this->isBind;
    }

    /**
     * 执行应用程序
     * @access public
     * @param Request|null $request
     * @return Response
     */
    public function run(Request $request = null): Response
    {
        //自动创建request对象
        $request = $request ?? $this->app->make('request', [], true);
        $this->app->instance('request', $request);

        try {
            $response = $this->runWithRequest($request);
        } catch (Throwable $e) {
            $this->reportException($e);

            $response = $this->renderException($request, $e);
        }

        return $response;
    }

    /**
     * 初始化
     */
    protected function initialize()
    {
        if (!$this->app->initialized()) {
            $this->app->initialize();
        }
    }

    /**
/www/wwwroot/www.startup-4.com/index.php
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// [ 应用入口文件 ]
namespace think;

require __DIR__ . '/vendor/autoload.php';

// 执行HTTP应用并响应
$http = (new App())->http;

$response = $http->run();

$response->send();

$http->end($response);
 

Environment & details:

Key Value
Version
"6.0.2"
URI
"http://www.andiff.net/new/1.html"
Request URI
"/new/1.html"
Path Info
"new/1.html"
Query String
"s=//new/1.html"
HTTP Method
"GET"
Base URL
"/new/1.html"
Scheme
"http"
Port
80
Host
"www.andiff.net"
empty
empty
empty
empty
empty
Key Value
USER
"www"
HOME
"/home/www"
HTTP_HOST
"www.andiff.net"
HTTP_USER_AGENT
"claudebot"
HTTP_ACCEPT
"*/*"
PATH_INFO
""
REDIRECT_STATUS
"200"
SERVER_NAME
"cp.andiff.cn"
SERVER_PORT
"80"
SERVER_ADDR
"172.25.254.45"
REMOTE_PORT
"43132"
REMOTE_ADDR
"52.90.40.84"
SERVER_SOFTWARE
"nginx/1.18.0"
GATEWAY_INTERFACE
"CGI/1.1"
REQUEST_SCHEME
"http"
SERVER_PROTOCOL
"HTTP/1.1"
DOCUMENT_ROOT
"/www/wwwroot/www.startup-4.com"
DOCUMENT_URI
"/index.php"
REQUEST_URI
"/new/1.html"
SCRIPT_NAME
"/index.php"
CONTENT_LENGTH
""
CONTENT_TYPE
""
REQUEST_METHOD
"GET"
QUERY_STRING
"s=//new/1.html"
SCRIPT_FILENAME
"/www/wwwroot/www.startup-4.com/index.php"
FCGI_ROLE
"RESPONDER"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1711657366.2707
REQUEST_TIME
1711657366
Key Value
APP_DEBUG
"1"
APP_DEFAULT_TIMEZONE
"Asia/Shanghai"
DATABASE_TYPE
"mysql"
DATABASE_HOSTNAME
"bdm285739178.my3w.com"
DATABASE_DATABASE
"bdm285739178_db"
DATABASE_USERNAME
"bdm285739178"
DATABASE_PASSWORD
"1qaz2wsxA"
DATABASE_HOSTPORT
"3306"
DATABASE_CHARSET
"utf8mb4"
DATABASE_DEBUG
""
DATABASE_TRIGGER_SQL
"1"
LANG_DEFAULT_LANG
"zh-cn"
0. Whoops\Handler\PrettyPageHandler