多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# defaultMethod 当控制器方法不存在的时候的默认方法 NormalRoute首先先匹配Controller,如果找不到直接返回404,然后寻找Method,如果找不到则会执行defaultMethod方法。 我们默认提供了一个处理机制。 ```php /** * 当控制器方法不存在的时候的默认方法 */ public function defaultMethod() { if ($this->request_type == SwooleMarco::HTTP_REQUEST) { $this->http_output->set_header('HTTP/1.1', '404 Not Found'); $template = $this->loader->view('server::error_404'); $this->http_output->end($template->render()); } else { throw new SwooleException('method not exist'); } } ``` 如果需要自定义请重写此方法。