我想阅读doc文件内容: PHPWord通过Composer安装。并将依赖添加到phpword中。 用于阅读内容我使用此代码加载空白视图。
require_once 'autoload.php';
$fileName = "test.docx";
$phpWord = \PhpOffice\PhpWord\IOFactory::load($fileName);
$PHPWord = new \PhpOffice\PhpWord\PhpWord();
$document = $PHPWord->loadTemplate($fileName);
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($PHPWord, 'Word2007');
$xmlWriter->save("php://output");
$sections = $phpWord->getSections();
$section = $sections[0];
$arrays = $section->getElements();