某个用户访问一个页面,如 http://mysite.com/getAllSiteFiles.php,会获得一个zip包,包里有很多文件。
关键是如何在给用户下载这个包的同时,又输出一个提示成功的html页面!?
谢谢!//输出zip包的代码:
// Headers for an download:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$zipfile_name.'"'); 
header('Content-Transfer-Encoding: binary');

// load the file to send:
$handle = fopen($zipfile_path, "rb");
$contents = fread($handle, filesize($zipfile_path));
file_put_contents("php://output",$contents);
fclose($handle);
//和以上四行一样!
//readfile($zipfile_path);