[英]Laravel get routes work, post don't
I just can't figure it out, why on my local environment the following routes work perfectly.... and on a Staging environment I have been provided, to test the code, it doesn't work as supposed to 我只是想不通,为什么下面的路由在我的本地环境中可以完美地工作...。而在我提供的暂存环境中,为了测试代码,它无法正常运行
Routes: 路线:
Route::controller(Controller::detect());
...
Route::get('api', array(
'as' => 'api_index',
'uses' => 'api@index',
));
Route::get('api/(:any)/(:any)', 'api.(:1)@(:2)');
Route::post('api/(:any)/(:any)', 'api.(:1)@(:2)');
Route::put('api/(:any)/(:any)', 'api.(:1)@(:2)');
Route::delete('api/(:any)/(:any)', 'api.(:1)@(:2)');
The problem stands at my post requests, as they just won't be found and always returning a 404 no mather the request. 问题出在我的发帖请求上,因为找不到请求,并且始终不返回404请求。 Example: 例:
POST
http://staging.test.com/api
-> 404 POST
http://staging.test.com/api
> 404 POST
http://staging.test.com/api/user
-> 404 POST
http://staging.test.com/api/user
> 404 POST
http://staging.test.com/api/user/session
-> 404 POST
http://staging.test.com/api/user/session
> 404 Where all of the above tests, work in my local environment. 以上所有测试均在我的本地环境中进行。 The GET
method works (the only one besides POST
that I have tested) GET
方法有效(除我测试过的POST
之外的唯一方法)
So what am I missing? 那我想念什么呢?
Tried changing the order of the Routes::
, and tried the different methods... but still the same result 尝试更改Routes::
的顺序,并尝试了不同的方法...但结果仍然相同
Just as @TheShiftExchange said, it seams to be the buggy Controller::detect()
's fault. 就像@TheShiftExchange所说的,它似乎是有故障的Controller::detect()
的错误。
Have tried also: 也尝试过:
Route::controller(array('api.user', 'api.device'));
But only got it to work with: 但只有它可以与:
Route::controller('api.user');
Route::controller('api.device');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.