Thinkphp6 Index控制器下面建立的hello()方法,不能访问非法请求:index/hello
2022-11-24 11:10:29
294
{{single.collect_count}}

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 * @paramarray $route 路由信息

 

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}