你用记事本打开个word文档看看,word不是简单纯文本。

解决方案 »

  1.   

    1.
    <?php
        header("Content-type: application/msword");
        readfile("test.doc");
    ?>
    2.
    使用com将word文档转换成html,然后显示html,如下:
    $word = new COM("word.application") or die("Unable to instanciate Word");
    $word->Visible = 1;
    $word->Documents->Open("d:/test.doc");
    $word->Documents[1]->SaveAs("x:/webPath/test_doc.html",8);
    $word->Quit();
    $word->Release();
    $word = null;
    header('path/test_doc.html');
      

  2.   

    怎么显示出word文件后却没有形成hmtl??
      

  3.   

    第一种方法本来就是调用客户的word,并嵌套在ie中来打开它,怎么会形成html呢第二种方法是先在服务器上转换成html
    然后可以用header("location:test_doc.html")转向它或者用header("Content-type: text/html");
    readfile("webPath/test_doc.html");
    然后再删除test_doc.html这个文件
      

  4.   

    用第二种方法是出错:Warning: Invoke() failed: No description available in E:\test\word.php on line 4Warning: Invoke() failed: 发生意外。 in E:\test\word.php on line 5Fatal error: NULL pointer exception in E:\test\word.php on line 5
    好象是php.ini的设置问题,请问如何设置????急急
      

  5.   

    不是php.ini设置问题。应该是你服务器office没有安装好。
    我的这里可以
      

  6.   

    不会吧!!我的office是已经装好,怎么样才知道装好了???
      

  7.   

    结帖:
    $fp = fopen("aa.doc", "rb"); 
    $read = fread($fp, filesize("aa.doc"));