I can't read my POST HTTP request's body with PHP !

前端 未结 3 1297
青春惊慌失措
青春惊慌失措 2020-12-06 16:40

I\'ve never used PHP but right now, I need to write a PHP file that displays in a log file the content of the body of a POST HTTP request.

I\'ve read that you can ac

3条回答
  •  天涯浪人
    2020-12-06 17:31

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

    php://input allows you to read raw POST data. It is a less memory intensive alternative to $HTTP_RAW_POST_DATA and does not need any special php.ini directives. php://input is not available with enctype="multipart/form-data".

    (Source: http://php.net/wrappers.php)

提交回复
热议问题