<?php
$file = "1.txt";// 文件的真实地址(支持url,不过不建议用url)

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}


?>

 

相关文章:

  • 2021-06-24
  • 2022-01-10
  • 2021-10-27
  • 2022-01-26
  • 2022-12-23
  • 2021-06-04
  • 2021-09-28
  • 2021-08-26
猜你喜欢
  • 2021-06-06
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2021-09-07
  • 2021-09-07
  • 2021-09-07
相关资源
相似解决方案