mar*_*605 0 php laravel laravel-5.4
我正在开始创建API,测试路由.这是我的路线/ api.php:
Route::get('/', 'ApiController@index');
Route::post('/foo', 'ApiController@store');
Run Code Online (Sandbox Code Playgroud)
这是我的ApiController.php
public function index()
{
return 'Hello, API';
}
public function store()
{
return 'API POST';
}
Run Code Online (Sandbox Code Playgroud)
在Postman上,GET方法有效.但POST返回405代码.
我的Http/Kernel.php没有限制:
protected $middlewareGroups = [
'web' => [
...
],
'api' => [
'throttle:60,1',
'bindings',
],
];
Run Code Online (Sandbox Code Playgroud)