zoukankan      html  css  js  c++  java
  • 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");
    示例:
    <?
    filename=′./download/d.rar′;filesize = filesize(filename);header("Content−Type:application/force−download");header("Content−Disposition:attachment;filename=".basename(filename));
    header( "Content-Length: ".filesize);data = file_get_contents(filename);echodata;
    ?>
    这段代码的意识是打开页面后立即出现下载保存窗口,下载的文件为,摘取了常用的部分,其实还有其他一些filename,摘取了常用的部分,其实还有其他一些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',
    );

  • 相关阅读:
    js简单工厂
    对象数组深浅拷贝
    分时函数的通用实现
    SQL技术内幕-4 row_number() over( partition by XX order by XX)的用法(区别于group by 和order by)
    SQL技术内幕-2
    SQL技术内幕-1
    js 阻止冒泡 兼容性方法
    C# 给数据库传入当前时间
    Ms sql server sql优化技巧
    SQl 字段中出现某一个词语的次数
  • 原文地址:https://www.cnblogs.com/linliquan/p/15075222.html
Copyright © 2011-2022 走看看