phpword读取word的文本内容

时间:2020-04-04 00:02:42   收藏:0   阅读:1194

use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\IOFactory;

$info = public_path().‘/uploads/admin/examination/test.docx‘;
$phpWord = new PhpWord();
$sections =IOFactory::load($info)->getSections();

foreach($sections as $section) {

  $elements = $section->getElements();
  foreach($elements as $element) {

    echo $element->getElements()[0]->getText() . "\n";
  }
}

原文:https://www.cnblogs.com/flyfly123/p/12629831.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!