Laravel得到路线工作,发帖不做(Laravel get routes work, post don't)

编程入门 行业动态 更新时间:2024-10-19 08:55:16
Laravel得到路线工作,发帖不做(Laravel get routes work, post don't)

我只是无法弄明白,为什么在我的本地环境中以下路由完美运行....并且在我提供的Staging环境中,为了测试代码,它不能正常工作

路线:

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)');

UPDATE

尝试改变Routes::的顺序,并尝试了不同的方法......但仍然是相同的结果

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)');

UPDATE

Tried changing the order of the Routes::, and tried the different methods... but still the same result

最满意答案

就像@TheShiftExchange所说的那样,它会成为错误的Controller::detect()的错误。

也试过了:

Route::controller(array('api.user', 'api.device'));

但只能使用它:

Route::controller('api.user'); Route::controller('api.device');

Just as @TheShiftExchange said, it seams to be the buggy Controller::detect()'s fault.

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');

更多推荐

本文发布于:2023-07-04 17:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1026929.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不做   发帖   路线   工作   Laravel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!