Laravel获取请求数据JSON不起作用

时间:2020-11-09 17:00:35

标签: laravel laravel-8

class CategoryController extends Controller
    ...
    public function store(CategoryRequest $request)
    {
        ...
    }
}
class CategoryRequest extends Request
{
    ...
}

我无法通过this->json()->all();从请求中获取json数据

...
use Illuminate\Foundation\Http\FormRequest;
...

class Request extends FormRequest
{
    public function validationData()
    {
        $this->isJson(); // return true
        $this->getContent(); // has data
        $this->json()->all(); // empty data
        $this->json; // empty data
        ...
    }
}

我使用Talend API测试api

this->json()->all();是如何工作的?

0 个答案:

没有答案