简体   繁体   English

Symfony2:找不到“ GET…”的路线

[英]Symfony2: No route found for “GET …”

I implemented my own error-controller so I get an email when there is an error in my project. 我实现了自己的错误控制器,所以当我的项目中出现错误时,我会收到一封电子邮件。 The project has been online for a while now and now and about once a day I get this error: 该项目现在或现在已经在线一段时间,每天大约一次,我会收到此错误:

There was an error on /dealer/search/ No route found for "GET /dealer/search/" / dealer / search /上没有错误,找不到“ GET / dealer / search /”的路由

This route doesn't exist, there is a route /deealer/search/top and /dealer/search/left. 该路由不存在,存在/ deealer / search / top和/ dealer / search / left路由。 Nobody ever complained about an error occurring. 没有人抱怨发生过错误。 This also happens with other pages and it is always the last part of the url that is missing. 其他页面也会发生这种情况,它始终是网址的最后一部分。

It is an intranet which you can only access after logging in, so it can't really be a bot or something. 它是一个Intranet,您只能在登录后访问,因此它实际上不能成为bot之类的东西。 I never received an email yet from someone who experienced this error, so I am a bit stuck where this is coming from. 我从未收到过遇到此错误的人的电子邮件,因此我有点被卡在了那里。

Does anybody have any idea what could possibly cause this? 有人知道什么可能导致这种情况吗?

You did not need to implement a custom error controller for emailing. 您无需实现用于电子邮件发送的自定义错误控制器。 You already have the Monolog integrated into Symfony2 that can do this and much, much more. 您已经将Monolog集成到Symfony2中,它可以做到这一点,甚至更多。

It is quite possible that people just removed the last part of the URL to see what happens. 人们很可能只是删除了URL的最后一部分以了解发生了什么。

These are exceptions thrown by the router when the page doesn't exists. 这些是页面不存在时路由器抛出的异常。

In other words, this is how Symfony signals page not found errors internally. 换句话说,这就是Symfony内部发出未发现错误信号的信号。 By default it displays a 404 Not Found page when these exceptions occur. 默认情况下,发生这些异常时,它将显示“ 404 Not Found页面。

IMHO the most possible answer would be that the user manually entered the URL, as @Putr suggests already. 恕我直言,最可能的答案是用户手动输入URL,正如@Putr已经建议的那样。 You might want to check your server log files to see who made the request and how the user got there. 您可能需要检查服务器日志文件,以查看谁发出了请求以及用户如何到达那里。 You could also write a functional test that checks all generated pages for the broken links. 您还可以编写一个功能测试 ,检查所有生成的页面中是否有断开的链接。 But that is probably a little too much. 但这可能有点太多。 In case you decide to do that make sure to check out the LiipFunctionalTestBundle 如果您决定这样做,请确保签出LiipFunctionalTestBundle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM