Notes Export time: Content-Type: application / vnd.ms-excel ">

Content-Type: application/vnd.ms-excel">

If you want to export query results to Excel, simply modify the page Context-Type what you can:
   header ( "Content-Type: the Application / vnd.ms-Excel">
If you want to be able to provide the open / save dialog , Content-Disposition parameter, Content-Disposition parameter was supposed to provide a suggestion of when the client save file name, but taking into account security reasons, it is removed from the specification of this parameter
Content-Disposition parameters:
Attachment --- Download as attachments   
inline --- online open
specific use such as: header ( "Content-Disposition: inline; filename = filename .mp3");
            header ( "Content-Disposition: attachment; filename = Test.xls");
in fact, IE is to identify the file type based on the suffix Content-Disposition of the filename in this segment in the filename, so,
if there are multiple file types, they can be Content-type set to binary mode:
            Header ( "Content-of the type: application / octet-stream ");
examples:
<?
filename=./download/d.rar;filename=′./download/d.rar′;filesize   =   filesize(filename);header("ContentType:application/forcedownload");header("ContentDisposition:attachment;filename=".basename(filename);header("Content−Type:application/force−download");header("Content−Disposition:attachment;filename=".basename(filename));
header( "Content-Length:   ".filesize);filesize);data   =   file_get_contents(filename);echO filename); echodata;
?>
Consciousness download this code is stored immediately after turning page window, the downloaded fileFILEn-AmE , pick take the regular use of the section points , which is a solid but also has its he was a few filename, partial removal of the common, in fact, there are other = Array mimetypes (
    'DOC' => 'the Application / msword',
    'bin' => 'the Application / OCTET-Stream',
    'EXE' => 'file application / OCTET-Stream',
    'SO' => 'file application / OCTET-Stream',
    'DLL' => '
    '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',  
);

Guess you like

Origin www.cnblogs.com/qingmuchuanqi48/p/11776404.html