EXCEL导出场景

查询结果导出到Excel:
header( "Content-Type: application/vnd.ms-excel">

浏览器打开/保存的对话框:
Content-Disposition参数:
attachment --- 作为附件下载   
inline --- 在线打开

header("Content-Disposition: inline; filename=文件名.mp3");
Header("Content-Disposition:attachment;filename=test.xls");

注:IE是根据Content-Disposition中filename这个段中文件名的后缀来识别这个文件类型的,所以,
如果有很多种文件类型的时候,可以将Content-Type设置为二进制模式的:

 Header("Content-type:   application/octet-stream");

附录:

mimetypes = array('doc'        => 'application/msword','bin'        => 'application/octet-stream','exe'        => 'application/octet-stream','so'        => 'application/octet-stream','dll'        => 'application/octet-stream','pdf'        => 'application/pdf','ai'        => 'application/postscript','xls'        => 'application/vnd.ms-excel','ppt'        => 'application/vnd.ms-powerpoint','dir'        => 'application/x-director','js'        => 'application/x-javascript','swf'        => 'application/x-shockwave-flash','xhtml'        => 'application/xhtml+xml','xht'        => 'application/xhtml+xml','zip'        => 'application/zip','mid'        => 'audio/midi','midi'        => 'audio/midi','mp3'        => 'audio/mpeg','rm'        => 'audio/x-pn-realaudio','rpm'        => 'audio/x-pn-realaudio-plugin','wav'        => 'audio/x-wav','bmp'        => 'image/bmp','gif'        => 'image/gif','jpeg'        => 'image/jpeg','jpg'        => 'image/jpeg','png'        => 'image/png','css'        => 'text/css','html'        => 'text/html','htm'        => 'text/html','txt'        => 'text/plain','xsl'        => 'text/xml','xml'        => 'text/xml','mpeg'        => 'video/mpeg','mpg'        => 'video/mpeg','avi'        => 'video/x-msvideo','movie'        => 'video/x-sgi-movie',
);

Content-Type相关推荐

  1. restTemplate http请求报错:no suitable HttpMessageConverter found for response type and content type

    报错信息: org.springframework.web.client.UnknownContentTypeException: Could not extract response: no sui ...

  2. Posted content type isn't multipart/form-data

    版权声明:欢迎转载,请注明沉默王二原创. https://blog.csdn.net/qing_gee/article/details/48712507 在有文件上传的表单提交过程中,搞不好就会报Po ...

  3. Maven报错解决:Element 'dependency' cannot have character [children], because the type's content type is

    在用maven的时候遇到报错: Element 'dependency' cannot have character [children], because the type's content ty ...

  4. 用VS向SharePoint中部署添加List 并指定应用的Content Type

    在SharePoint Project中添加相应的Item,完全用界面的形式向EricSunArticlesList中添加好对应的Column,之后用Feature将List添加到SharePoint ...

  5. Spring Boot——[Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported]解决方案

    问题描述 2020-02-13 19:32:04.322 WARN 109508 --- [p-nio-80-exec-4] .m.m.a.ExceptionHandlerExceptionResol ...

  6. : Content type 'text/plain;charset=UTF-8' not supported

    : Content type 'text/plain;charset=UTF-8' not supported

  7. eclipse 设置 content type 编码格式

    前言 Eclipse Version: 2019-12 (4.14.0) 操作 打开Preferences.菜单路径为:Window–> Preferences 在搜索框中输入:content ...

  8. sendData to ABAP backend via multiple form content type

    Created by Jerry Wang, last modified on Aug 20, 2014 使用multipart/form-data的content type通过Javascript向 ...

  9. 阿里云存储OSS中设置上传文件content type

    阿里云存储OSS中设置上传文件ContentType 如果你使用浏览器上传文件,则浏览器会自动在header中设置正确地content type,然后对文件的访问会得到正确地回应. 如果采用编程的方式 ...

  10. Sharepoint学习笔记—Site Definition系列-- 2、创建Content Type

    Sharepoint本身就是一个丰富的大容器,里面存储的所有信息我们可以称其为"内容(Content)",为了便于管理这些Conent,按照人类的正常逻辑就必然想到的是对此进行&q ...

最新文章

  1. 合肥工业大学—SQL Server数据库实验一:数据库的创建和删除
  2. python输出星期名缩写_在Python中解析带有时区缩写名称的日期/时间字符串?
  3. Android MediaScanner:(一)MediaScanner总体架构
  4. 家用计算机历史记录,教您如何查看电脑使用记录
  5. Python学习笔记(八)随机数的处理
  6. 哪些手机搭载鸿蒙,鸿蒙2.0搭载手机吗-有什么功能
  7. React全家桶项目
  8. ArcGIS制图表达Representation-制图表达原理
  9. jquery 之for 循环
  10. Spring 3.0: Unable to locate Spring NamespaceHandler for XML schema namespace
  11. LabWindows 读写 Excel
  12. hive之内表和外表
  13. docer 设置 拉取http协议的私有仓库
  14. 学会运用爬虫框架 Scrapy各类技术文章大汇总
  15. 清理C盘(浪费了很多时间,终于找到了一个比较高效的方法)
  16. Plantuml类图用法
  17. ABP框架系列之三十一:(Localization-本地化)
  18. Java如何dump文件
  19. ssm培训课程管理系统的微信小程序
  20. 苹果酱的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告

热门文章

  1. extjs html页面刷新,ExtJS onReady引发的浏览器对页面的加载过程
  2. java 1是flase_Java这段代码为什么会返回 false?传入的是字符串[1,1]
  3. android studio提示要重写的方法,Android Studio 重写方法时参数命名异常
  4. 禁止存放到内存_暴雨 ! 神木能源局:关于煤炭运输及存放的通告
  5. 网站“设为首页”代码,“加入收藏”代码
  6. BFS - 20190206
  7. POJ - 2559 Largest Rectangle in a Histogram(单调栈)
  8. MySQL迁移至MariaDB
  9. java 用 jxl poi 进行excel 解析 *** 最爱那水货
  10. wp8.1 页面返回 页面导航