我有一个Laravel 8项目。除了
下面的代码外,一切正常Route::get('/', function ()
{
return redirect('/login');
});
这些代码只在我使用php artisan route:clear
清除路由缓存时运行,否则每次在i缓存路由后都会返回此错误:
SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: HEAD.
我希望我的用户可以进入登录页面,尽管他们访问http://localhost/myproject/public/
或http://localhost/myproject/public/login
1。将此添加到web.phpuse IlluminateSupportFacadesRoute;
的顶部2。
Route::get('/greeting', function () {
return 'Hello World';
});
路由Laravel