大家知道,如果要用webbrowser打开.诸如.xls,.doc等文件时必须修改http header,
Content-type:application/vnd.ms-excel(http header)
Content-Disposition:"attachment; filename=fileName" (MIME扩展协议)现在我想让IE读取server上的xls文件,并且在Client上显示.我的代码是:<?php
header( "Content-type:application/vnd.ms-excel ");
header( "Content-Disposition:filename=test.xls ");
?>我的test.xls文件是:
Content-type:application/vnd.ms-excel(http header)
Content-Disposition:"attachment; filename=fileName" (MIME扩展协议)现在我想让IE读取server上的xls文件,并且在Client上显示.我的代码是:<?php
header( "Content-type:application/vnd.ms-excel ");
header( "Content-Disposition:filename=test.xls ");
?>我的test.xls文件是:
解决方案 »
- php数组排序
- google merchant center提交数据文件,状态显示“未插入任何信息条目 ”
- php新人求助,如何调用dll
- Zend Stuio 的使用问题,怎样运行第一个程序
- 请问哪些原因会造成PHP SESSION在Linux中的丢失?
- 学PHP看哪本书好??谁推荐一下?要中文的.
- 如何在linux命令行执行某个php脚本?
- 急问............$HTTP_COOKIE_VARS
- 我是第一次发帖子!请各位关照,谢谢!我在做提交表单的时候,遇到了一个莫名其妙的问题,不知各位能不能给解决一下!
- 新人学习问题1,这段内嵌css为什么不能把图片变成灰色
- 请问下如何求两段时间的交集
- linux下php变成应该用什么ide
$filename=$_GET["conditionArr"];//传一个文件
if (!file_exists($filename)) {
echo $filename;
error_log("Error: file " . $file_path . " not found!", 0);
exit;
}
$filesize=filesize($filename);
$fp = fopen($filename, 'rb');
header("Content-Type:text/plain");
header("Accept-Ranges:bytes");
header("Accept-Length:".filesize($filename));
header("Content-Disposition:attachment;filename=".basename($filename));
flock($fp, 2);
$attachment = @fread($fp, $filesize);
echo $attachment;
fclose($fp);
?>