read word document in php

前端 未结 4 1437
北荒
北荒 2020-12-06 07:31

I\'m doing a project now, and I\'m stuck with reading word documents.

Word File content.

This is a test word file in PHP.

Thank you.
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 07:51

    "docx" is different from "doc". Docx files are basically xml files in a zipfile container (as described by wikipedia). Doc files are binary blobs.

    I am aware of no library that can easily read docx files in php (although Phpdocx can write them). However, since these are just zip files and xml files, you should be able do put something together using ZipArchive to open the docx container and DOMDocument or SimpleXML or XMLReader or XSLTProcessor to read the xml documents themselves.

提交回复
热议问题