简体   繁体   English

在Laravel 4.2中路由时无效的路由

[英]Invalid Route when routing in Laravel 4.2

I'm trying to create a new route, and for the life of me can't figure out why it's returning an invalid route response. 我正在尝试创建一条新路线,而我一生都无法弄清为什么它返回invalid route响应。

Here is the route (there are no filters on this route): 这是路线(此路线上没有过滤器):

Route::get('api/books/{bookId}', 'BookController@getBook');

Here is the URL I use to query this route: 这是我用来查询此路线的URL:

https://fakeBookSite.com/api/books/2?apiKey=someRandomKey https://fakeBookSite.com/api/books/2?apiKey=someRandomKey

What is even stranger is that this route works: 更奇怪的是,这条路线可行:

Route::get('api/books', 'BookController@getBooks');

The route that works is listed BEFORE the one that doesn't, which is best practice in my understanding. 在无效的路由之前列出了有效的路由,据我所知,这是最佳实践。

Even stranger , when I comment out the routes that do work, they still work when queried. 甚至是陌生人 ,当我注释掉起作用的路线时,在查询时它们仍然起作用 I can only imagine that this is a caching issue, but as you will see below, I have cleared all the caches that I know about. 我只能想象这是一个缓存问题,但是正如您将在下面看到的,我已经清除了我所知道的所有缓存。

I have ran composer dump and composer clear and php artisan cache:clear . 我已经运行了composer dumpcomposer clearphp artisan cache:clear Your thoughts are highly appreciated! 非常感谢您的想法!

The issue was actually a result of my FTP connection. 该问题实际上是我的FTP连接导致的。 I suppose that the files I was editing were not actually changing the server files. 我想我正在编辑的文件实际上并没有更改服务器文件。 This just goes to show that if you feel you've tried everything, just 'restarting' is the way to go! 这只是表明,如果您觉得自己已尝试了所有方法,则只需“重新启动”即可!

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

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