【问题标题】:The file PhpOffice\PhpWord\TemplateProcessor.php is missing in the includes folder包含文件夹中缺少文件 PhpOffice\PhpWord\TemplateProcessor.php
【发布时间】:2021-10-28 13:26:35
【问题描述】:

我正在创建一个自定义 php 项目,该项目使用 https://github.com/PHPOffice/PHPWord 导出 docx 文件。在我的本地主机上成功测试后,我将它部署在服务器中,但不幸的是,我收到此错误:

The file PhpOffice\PhpWord\TemplateProcessor.php is missing in the includes folder.

这就是我调用文件的方式

$file_name = dirname(__FILE__).'/template/template.docx';
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($file_name);

我已经尝试了stackoverflow的几种方法,但仍然无法修复它。

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: phpword phpoffice


    【解决方案1】:

    我通过安装解决了它

    composer require phpoffice/phpword
    

    然后

    require_once $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
    $file_name = dirname(__FILE__).'/template/template.docx';
    $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($file_name);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 1970-01-01
      • 2021-08-30
      • 2018-12-26
      • 1970-01-01
      • 1970-01-01
      • 2014-09-20
      相关资源
      最近更新 更多