路线未退出但仍可以访问?

时间:2018-07-07 08:05:00

标签: laravel laravel-5 routes

我没有在 routes.php <中路由 / home home / em> ,但我仍然可以访问此路由。 。登录时有时会出现问题。有时,当我尝试登录时,在成功通过身份验证后,我将重定向此路由,但是为什么要重定向,因为在route.php中该路由不存在。也可以通过 localhost:8000 / home 进行访问。我的routes.php如下。任何帮助将不胜感激。谢谢

place   gender  Radio
1   Male    No
1   Female  Yes
1   Male    No
1   Female  Yes
1   Male    Yes
1   Male    Yes
1   Female  Yes
1   Female  Yes
1   Male    Yes
1   Female  No
1   Male    Yes
1   Male    Yes
1   Male    No
1   Female  No
1   Female  Yes
1   Female  Yes
1   Female  No
1   Male    Yes
1   Female  No
1   Female  Yes
1   Female  No
1   Female  Yes
1   Male    No
1   Male    No
1   Female  No
1   Male    No
1   Female  No
1   Female  No
1   Female  No
1   Male    Yes
1   Female  No
1   Female  No
1   Female  Yes
1   Male    No
1   Male    Yes
1   Female  No
2   Male    Yes
2   Male    Yes
2   Female  No
2   Female  No
2   Male    Yes
2   Female  No
2   Male    No
2   Male    Yes
2   Female  No
2   Female  No
2   Female  No
2   Male    No
2   Female  No
2   Male    No
2   Female  Yes
2   Female  Yes
2   Male    Yes
2   Male    No
2   Male    Yes
3   Female  No
3   Male    Yes
3   Female  No
3   Male    No
3   Male    Yes
3   Female  No
3   Female  Yes
3   Male    No
3   Male    Yes
3   Female  Yes
3   Male    No
3   Female  No
3   Female  Yes
3   Female  No
3   Female  Yes
3   Female  No
3   Male    Yes
3   Female  No
3   Female  No
4   Male    Yes
4   Female  No
4   Female  Yes
4   Female  Yes
4   Male    Yes
4   Female  No
4   Female  No
4   Male    No
4   Female  No
4   Female  No
4   Female  No
4   Male    Yes
4   Male    Yes
4   Female  Yes
4   Female  No
4   Male    Yes
4   Male    Yes
4   Male    Yes
4   Female  No
4   Female  No
4   Female  No

1 个答案:

答案 0 :(得分:1)

如果您正在使用Laravel身份验证,则它将在成功登录后将用户重定向到/home

  

成功验证用户身份后,他们将被重定向到   / home URI。您可以自定义身份验证后重定向   通过在LoginController上定义redirectTo属性来定位位置,   RegisterController和ResetPasswordController:

     

protected $redirectTo = '/';

     

如果重定向路径需要自定义生成逻辑,则可以定义redirectTo方法而不是redirectTo属性:

 protected function redirectTo()
 {
     return '/path';
 }

请参见docs

您可以通过更新上述控制器中的$redirectTo prop或redirectTo()方法来更改路线。