set_time_limit(0);
ini_set('memory_limit', '512M');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
ob_end_clean();
readfile($file);

主要注意前面2个设置(根据情况自己设置内存大小)和 ob_end_clean();函数的调用。

相关文章:

  • 2021-06-07
  • 2021-11-20
  • 2021-08-05
  • 2021-11-18
  • 2022-12-23
  • 2021-09-22
  • 2021-10-29
  • 2022-01-28
猜你喜欢
  • 2022-02-16
  • 2021-09-13
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案