zoukankan      html  css  js  c++  java
  • php文件下载

    function DownloadFile($parameters){
      $fsize	= filesize($parameters['filepath']);
      apache_setenv('no-gzip', 1);
      header("Expires: 0");
      header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
      header("Content-Length: " . $fsize);
    
      if(preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']))
      {
        header('Content-Disposition: attachment; filename="' . iconv('UTF-8', 'GBK', $parameters['name']) . '"');
      } else if(strstr($_SERVER['HTTP_USER_AGENT'], 'Firefox')){
        header('Content-Disposition: attachment; filename="' . $parameters['name'] . '"');
      } else {
        header('Content-Disposition: attachment; filename="' . $parameters['name'] . '"');
      }
    
      header("Content-Transfer-Encoding: binary");
      header('Content-type: application/force-download');
      //header("Content-Type: application/zip"); //zip格式的
      readfile($parameters['filepath']); 
    }

      把以前写的东西整理一下,发出来

  • 相关阅读:
    Xargs
    录制终端会话-script--查找find
    命令之乐-cat
    Linux_shell编程--比较与测试
    线程进程
    计算机网络基础
    python基础-列表相关
    初学Python
    numpy 基本的数组统计方法
    python 操作mysql 入门
  • 原文地址:https://www.cnblogs.com/zhaozhilu/p/2731032.html
Copyright © 2011-2022 走看看