找不到404,但是在Laravel 5.4中存在路由 [英] 404 Not Found, but route exist in Laravel 5.4

查看:550
本文介绍了找不到404,但是在Laravel 5.4中存在路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PhpStorm.我可以运行并打开index.php,但是当我想按提交"按钮(登录后)时,找不到其显示404.

I'm using PhpStorm. I can run and open the index.php, but when I want to press submit button (post sign in), its display 404 not found.

在Windows 10上运行的Web服务器Apache 2.4.

Web server Apache 2.4 running on Windows 10.

这是我的家

这是我的路线

推荐答案

我不完全确定为什么要进行所有否决,尤其是因为这是一个常见问题,而对于Laravel环境中的新手来说,原因可能是隐藏的.我知道这是一篇旧文章,但我将其添加到此处以供将来的新手使用.

I'm not entirely sure why all the down-votes, especially since this is a common issue and the cause can be hidden for someone new to the Laravel environment. I know this is an old post, but I add it here for future newbies.

我建议尝试的第一件事是从命令行(从项目根目录)运行php artisan route:list.这将列出Laravel可以注册的所有路线,并且如果有任何错误,通常它们会显示在这里.

The first thing I suggest trying is running php artisan route:list from the command line (from your project root directory). This will list all the routes that Laravel can register and if there are any errors, usually they will show up here.

我建议的第二件事是确保URL与路由匹配.我无法告诉您多少次我试图弄清为什么我的路线返回404的原因仅仅是因为我的路线被定义为/admin/insertStudent

The second thing I suggest is to ensure that the URL matches route. I can't tell you how many times I've tried to figure out why my route was returning a 404 simply because my form was posting to something like /insertStudent when my route was defined as /admin/insertStudent

我建议的第三件事是确保要调用的方法存在.您的方法真的被称为postSignInpostInsertStudent而不是简单地称为SignInInsertStudent吗?请记住,URL和方法名称均区分大小写,并且应与定义路由的位置,正在调用的URL以及接收请求的方法相匹配.

The third thing I suggest is to ensure the method you are calling exists. Are your methods really called postSignIn and postInsertStudent and not simply SignIn and InsertStudent? Keep in mind that both the URL and method names are case sensitive and should match where you define the route, the URL that is being called, and the method that is receiving the request.

最后,如果所有检查都成功了,我可能建议您尝试的最后一件事是运行php artisan route:clear.这将重置路由缓存.

Finally if all that checks out, one last thing I might suggest you try is running php artisan route:clear. This resets the route cache.

这篇关于找不到404,但是在Laravel 5.4中存在路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆