스크립트에서 단어 문서를 열려고했지만 동일한 오류가 발생합니다.'COM'클래스가 없습니다.
Fatal error: Class 'COM' not found in /Applications/XAMPP/xamppfiles/htdocs/**/**.php on line 3
내 코드 :
<?php
$word = new COM("word.application") or die("Unable to instantiate Word");
$word->Visible = 1;
$word->Documents->Open("wordfile.docx");
$temp = $word->Dialogs->Item(228); // returns wdDialogToolsWordCount dialog object
$temp->Execute(); //updates the word count
$numwords = $temp->Words(); //gets the words out of it
echo 'Word count = '.$numwords;
$word->Quit();
?>
나는 php.ini
을 변경하고 COM
섹션에서 세미콜론을 제거하기 위해 노력했습니다.
[com]
path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
com.typelib_file =
allow Distributed-COM calls
com.allow_dcom = true
autoregister constants of a components typlib on com_load()
com.autoregister_typelib = true
register constants casesensitive
com.autoregister_casesensitive = false
show warnings on duplicate constat registrations
com.autoregister_verbose = true
여전히 동일한 오류가 발생합니다.
저는 Mac에서 XAMMP
을 사용하고 있고 Linux 기반 웹 호스팅을 사용하고 있습니다.
COM은 Windows에서만 사용할 수 있습니다. –