函数
function downLoad($fileName = '未命名文件', $fileUrl = null) { if(empty($fileUrl)) return false; set_time_limit(200); ob_end_clean(); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=$fileName"); readfile($fileUrl); exit(); }
使用
通过PHP实现下载1.zip
download('1.zip','../1.zip');