路线不是定义的惯性。
在我的控制器中,我有一种重定向到路由的方法:
return Redirect::route('/management');
这是我的routes/web.php
:
Route::get('/management', function () {
return Inertia::render('Management');
});
但是,它引发了一个错误,说route [管理]未定义
> 。
In my controller, I have a method to redirect to a route:
return Redirect::route('/management');
This is my routes/web.php
:
Route::get('/management', function () {
return Inertia::render('Management');
});
However, it throws an error saying Route [management] not defined
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
redirect :: route()
方法期望A 路由,您尚未在路由/web.php
文件中定义的路由。为了使用命名路线,您需要更改路线:
之后,您可以将其重定向到惯性中的命名路线:
由于我们使用命名路由,而不是URL,因此您不应包括领先的
/
在您的route()
呼叫中。The
Redirect::route()
method expects a named route, which you have not defined in yourroutes/web.php
file.In order to use a named route, you need to change your route to:
After that, you can redirect to named routes in Inertia like so:
Since we're using named routes, and not URLs, you should not include the leading
/
in yourroute()
call.