php com word.application outup to html file but unknow file


php com word.application outup to html file but unknow file

这是我的代码:

$word = new COM("word.application");
$word->Visible = 1;
$word->Documents->Open('./../Team.docx');
$filename = tempnam(sys_get_temp_dir(), "");
$word->Documents[1]->SaveAs($filename);
$word->quit();
unset($word);
//header("Content-type: application/vnd.ms-word");
//header("Content-Disposition: attachment;Filename=test.doc");
header('Content-Encoding: UTF-8');
header('Content-type: text/html; charset= UTF-8');
header("Content-Disposition: attachment;Filename=Test.html");
// Send file to browser 
readfile($filename);
unlink($filename);

我的代码的想法是读取文件Ms.Word而不是将其SaveAsHTML文件中的新文件中,但还不正确,任何人都有任何想法,请建议我PHP这样做

我现在得到了答案,我将这个答案发布给像我这样遇到问题的人

将文件从.doc转换为.html