Javascript Ajax在IE中使用php实现gzip
此代码适用于chrome和firefox,但不适用于IE,数据经过压缩:Javascript Ajax在IE中使用php实现gzip,javascript,php,ajax,internet-explorer,gzip,Javascript,Php,Ajax,Internet Explorer,Gzip,此代码适用于chrome和firefox,但不适用于IE,数据经过压缩: $output_compressed = gzencode($output_json); $splitString = str_split($output_compressed, 1024); header("Content-type: application/javascript; charset: UTF-8"); header('Content-Length: ' . (string)
$output_compressed = gzencode($output_json);
$splitString = str_split($output_compressed, 1024);
header("Content-type: application/javascript; charset: UTF-8");
header('Content-Length: ' . (string)strlen($output_compressed));
header('Vary: Accept-Encoding');
header('Content-Encoding: gzip');
header('Connection: keep-alive');
header('Transfer-Encoding: gzip');
foreach($splitString as $chunk) {
echo $chunk;
flush();
}
ajax部分:
xhr = $.ajax({
type: "POST",
url: "getJSON.php",
data: postData,
success: function(data){...
我错过了什么 顺便说一句,我用的是HHVM。顺便说一句,我用的是HHVM。