function down_file($url,$type=‘application/zip‘){ header("Cache-Control: public"); header("Content-Description: File Transfer"); header(‘Content-disposition: attachment; filename=‘.basename($url)); //文件名 header("Content-Type: ".$type); //zip格式的 header("Content-Transfer-Encoding: binary"); //告诉浏览器,这是二进制文件 header(‘Content-Length: ‘. filesize($url)); //告诉浏览器,文件大小 @readfile($url); }
时间: 2024-10-25 14:51:40