php中word/doc轉html

第一步:安裝 PhpOffice\PhpWord

github地址:https://github.com/PHPOffice/PHPWord/

這裏僅支持composer安裝,

第二步:引入PhpWord


$path = './file.doc';//文件路徑
$path2 = './test_doc_html.html';//存放的路徑

include_once(ROOT_PATH.'vendor/autoload.php');//ROOT_PATH 這是項目根目錄 這個位置看你自己的
$phpWord = \PhpOffice\PhpWord\IOFactory::load($path);
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "HTML");
$xmlWriter->save($path2);

 

發佈了36 篇原創文章 · 獲贊 6 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章