mut*_*ron 1 gzip zend-framework2
我正在回调zf2 api调用中似乎是gzip压缩的数据.内容类型是gzip,内容主体看起来是编码的.所以我尝试了这个:
$decoded = $response->decodeGzip($response->getContent());
Run Code Online (Sandbox Code Playgroud)
我收回了这个错误:
Call to protected method Zend\Http\Response::decodeGzip()
Run Code Online (Sandbox Code Playgroud)
为什么受到保护?似乎解码gzip压缩数据是一件很方便的事情.
你应该用$response->getBody().该getBody()方法检查Content-Encoding标头,如果这是gzip,它将从Gzip内容中提取正文.
您可以在在线存储库中检查此方法:Zend\Http\Response
| 归档时间: |
|
| 查看次数: |
546 次 |
| 最近记录: |