[php] <?php //下载文件 function download_file($file){ if(is_file($file)){ $length = filesize($file); $type = mime_content_type($file); $showname = ltrim(strrchr($file,'/'),'/'); header("Content-Description: File Transfer"); header('Content-type: ' . $type); header('Content-Length:' . $length); if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { //for IE header('Content-Disposition: attachment; filename="' . rawurlencode($showname) . '"'); } else { header('Content-Disposition: attachment; filename="' . $showname . '"'); } readfile($file); exit; } else { exit('文件已被删除!'); } } ?> [/php]

相关文章:

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