2009-03-03 102 views

回答

11

您可以使用gzencode函數輕鬆應用gzip壓縮。

<? 
header("Content-Disposition: attachment; filename=yourFile.xml.gz"); 
header("Content-type: application/x-gzip"); 

echo gzencode($xmlToCompress); 
+0

正是我在找的東西。謝謝! – pistolshrimp 2009-03-03 06:41:11

0

如果沒有可用的gzip module做,

<?php 

    system('gzip filename.xml'); 

?> 
1

像這樣的事情?

<?php 
header('Content-type: application/x-gzip'); 
header('Content-Disposition: attachment; filename="downloaded.gz"'); 
$data = implode("", file('somefile.xml')); 
print(gzencode($data, 9)); //9 is the level of compression 
?> 
相關問題