Payload retrieval methods and techniques
P粉176203781
P粉176203781 2023-08-22 12:25:46
0
2
468

I'm using PHP, ExtJS and ajax store.

It does not send data via POST or GET when creating, updating and deleting. In the Chrome console I can see my outgoing parameters as JSON in the "Request Payload" field. $_POST and $_GET are empty.

How to retrieve it in PHP?

P粉176203781
P粉176203781

reply all (2)
P粉216807924

Meanwhile, you can usewriterto configureencode: trueto set up extJs so that it sends data periodically (so, You will be able to retrieve data via$_POSTand$_GET).

renew

At the same time,documentalso mentioned:

Therefore,writer'srootconfiguration may be required.

    P粉393030917

    If I understand the situation correctly, you are just passing the json data through the http body, not theapplication/x-www-form-urlencodeddata.

    You can get this data using the following code snippet:

    $request_body = file_get_contents('php://input');

    If you are passing json data, you can use the following code:

    $data = json_decode($request_body);

    $datanow contains the json data in the php array.

    php://inputis a so-calledwrapper.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!