douchaqi3369 2018-08-13 19:57
浏览 142
已采纳

读取PHP中的请求有效负载

How can I read content of Request Payload (POST) using PHP?

I´m using a Angular aplication to send the POST.

I've tried with: $_POST, $_FILES and file_get_contents('php://input') ...

None worked.

  • 写回答

2条回答 默认 最新

  • duannuan0074 2018-08-13 20:08
    关注

    If you need view x-www-form-urlencoded post data, just use

    print_r($_POST);
    

    If you need view json post data, use this

    $data=json_decode(file_get_contents('php://input'),1);
    print_r($data);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?