搭建好tp6后
Thinkphp6 Index控制器下面建立的hello()方法,不能访问,总是提示非法请求,换成其它方法名都没问题,就是hello不能用.
http://xxx/index.php/index/hello
提示
#0 [0]HttpException in Url.php line 89
非法请求:index/hello
原因是
原因,route/app.php 定义了路由, 定义路由规则后,原来的URL地址将会失效,变成非法请求。
use think\facade\Route;
Route::get('think', function () {
return 'hello,ThinkPHP6!';
});
Route::get('hello/:name', 'index/hello');
定义路由后就只能访问下面的URL地址
http://xxx/hello/thinkphp
标签:index,请求,Route,非法,thinkphp6,php,hello
From: https://www.cnblogs.com/cute/p/16870222.html