Thinkphp6 Index控制器下面建立的hello()方法,不能访问,总是提示非法请求,换成其它方法名都没问题,就是hello不能用.
原因,定义了路由
route里屏蔽掉 Route::get('hello/:name', 'index/hello');
非法请求:index/hello
}
// 设置当前请求的参数
$this->param = $var;
// 封装路由
$route = [$controller, $action];
if ($this->hasDefinedRoute($route)) {
throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url));
}
return $route;
}
/**
* 检查URL是否已经定义过路由
* @access protected
* @param array $route 路由信息