如何解决 laravel8 中的重定向?
how to resolve Redirection in laravel8?
路由未重定向 laravel8 中的指定路由。
这是我在 web.php:
中定义的代码
Route::get('/', function () {
return redirect()->route('login');
});
点击'/'后,我需要重定向到这条路线:
Route::get('login', 'LoginController@login')->name('login');
我遇到了一个错误:
The GET method is not supported for this route. Supported methods: HEAD.
如何解决?
试试
php artisan optimize
或
php artisan route:clear
或者您可以更改重定向
来自
return redirect()->route('login');
到
return redirect('/login');
试试这个来清除缓存:
php artisan optimize:clear
php artisan route:clear
参考:https://github.com/laravel/framework/discussions/34512#discussioncomment-564416
路由未重定向 laravel8 中的指定路由。
这是我在 web.php:
中定义的代码Route::get('/', function () {
return redirect()->route('login');
});
点击'/'后,我需要重定向到这条路线:
Route::get('login', 'LoginController@login')->name('login');
我遇到了一个错误:
The GET method is not supported for this route. Supported methods: HEAD.
如何解决?
试试
php artisan optimize
或
php artisan route:clear
或者您可以更改重定向
来自
return redirect()->route('login');
到
return redirect('/login');
试试这个来清除缓存:
php artisan optimize:clear
php artisan route:clear
参考:https://github.com/laravel/framework/discussions/34512#discussioncomment-564416