用AI赚第一桶💰低成本搭建一套AI赚钱工具,源码可二开。 广告
# 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'); } } ``` 如果需要自定义请重写此方法。