转载地址 https://imququ.com/post/how-to-compress-http-request-body.html
$encoding = $_SERVER['HTTP_CONTENT_ENCODING'];
$rawBody = file_get_contents('php://input');
$body ='';
switch($encoding) {
case'gzip':
$body = gzdecode($rawBody);
break;
case'deflate':
$body = gzinflate(substr($rawBody,2,-4)) . PHP_EOL . PHP_EOL;
break;
case'deflate-raw':
$body = gzinflate($rawBody);
break;}
echo $body;
eg: post gzip的使用
Post 文件传输
header Content-Encoding = ‘gzip’ Content-Type='application/json'
body 二进制gzip 压缩过的文件