Get PUT params with Slim PHP

后端 未结 2 1613
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 11:11

I searched, but I didn\'t find an answer. I have a RESTful API to manage a basic CRUD. I\'m trying to create an update method using PUT, but I can\'t retrieve the params val

相关标签:
2条回答
  • 2021-01-17 11:46

    $app->request->put() is returning a null value...

    so u can use try $app->request->params instead

    0 讨论(0)
  • 2021-01-17 11:50

    I had the same problem. Firstly, I was sending PUT data with the Postman option to encode it as "form-data", that's why Slim wasn't getting the param values.

    As it is explained in W3, the content type "multipart/form-data" should be used for submitting forms that contain files, non-ASCII data, and binary data.

    In our case, we have to send PUT data with the Postman option "x-www-form-urlencoded" (see explanation of "application/x-www-form-urlencoded" in W3).

    Screenshot of the right Postman option selected

    0 讨论(0)
提交回复
热议问题