public function execute(Request $request, Response $response, ...$params) { $this->getLogger()->debug('404 - Not Found'); $response->header('HTTP/1.1 404 Not Found'); ob_start(); include BASE_PATH . '/Views/404.php'; $content = ob_get_contents(); ob_end_clean(); $response->write($content); }
/** * 处理请求 * * @param Request $request Request Object * @param Response $response Response Object * @param mixed $params * * @return void */ public function execute(Request $request, Response $response, ...$params) { $this->getLogger()->debug('404 - Not Found'); $response->header('HTTP/1.1 404 Not Found'); if (!empty($params)) { $response->write(...$params); } else { $response->write("Not Found."); } }
/** * 处理请求 * * @param Request $request Request Object * @param Response $response Response Object * @param mixed $params * * @return void */ public function execute(Request $request, Response $response, ...$params) { if (is_string($this->_params[0])) { $response->write(...$this->_params); } else { if (is_callable($this->_params[0])) { $this->_params[0]($request, $response); } else { throw new \DomainException('INVALID_ROUTER_FUNC'); } } }
/** * Write output to response object * * @param Response $response * * @return mixed */ public function output(Response $response) { $response->header('Content-Type:text/html; charset=utf-8'); $response->write($this->render()); }