大家知道,如果要用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文件是:

解决方案 »

  1.   

    你搜索下php导入excel的类,能读取到excel的数据显示应该不是问题吧!
      

  2.   

    是打算把服务器上的xls文件下载到客户端还是读取服务器的xls文件显示在网页上?
      

  3.   

    下载的话<?
    $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);  
     
     ?>
      

  4.   

    你谷姐一下  PHP excel 读取类