search

Home  >  Q&A  >  body text

php - Please ask. . How to get formdata data submitted by post in laravel

Please be clear when writing, this is API, post data submitted by a third party,

I don’t know what data form-data will send.

So what I want is to get all the data submitted through POST form-data.

Normally speaking, $request->all gets all the data from the front desk,

However, if it is submitted by a third party, using $request->all cannot directly obtain the form-data data.

The winner said that I haven’t found a way to get form-data directly

Now you can only use the native method to get it..

I solved it myself. $request->all can get the data submitted by the third party through GET, but cannot get it through POST. You can use getcontent to get it.

迷茫迷茫2798 days ago1561

reply all(4)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:01:50

    I did it myself. None of the methods you mentioned can work. request->all obtains get. Post cannot be obtained by this method. You need to use getcount. I don’t know how you feel about those few points. It doesn’t matter. I took care of it myself.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-16 13:01:50

    can be accessed via Request 对象来获取。
    如获取表单全部数据, $request->all()
    获取表单中键名为name的字段,$request->get('name') .
    For detailed information, please refer to the official documentation.

    reply
    0
  • 阿神

    阿神2017-05-16 13:01:50

    I wrote a Demo on GitHub, you can take a look. https://github.com/MhcII/Form...

    $request->all() can still be retrieved. I just tested this code and it works.

    foreach ($request->all() as $key=>$param) {
        if (is_object($param)) {
            // 这里是 file
        } else {
            // 这里是 text
        }
    }

    reply
    0
  • 黄舟

    黄舟2017-05-16 13:01:50

    $request->all(); // 获取form表单中的所有字段值
    $request->input('name'); // 获取form表单中输入框name='name'的字段值

    reply
    0
  • Cancelreply