首页 > 解决方案 > 服务器上的 TemplateProcessor 错误 500 但不是本地

问题描述

我对 phpWord 和 TemplateProcessor 有疑问。我做了一个非常简单的例子:

require '../../vendor/autoload.php';

$document = new \PhpOffice\PhpWord\TemplateProcessor('test/test2.docx');

$document->setValue('test',1);


$document->saveAs('test2.docx');
header("location:test2.docx");

当我在笔记本电脑上运行它时,一切都很好,但在服务器上,什么也没有发生,我收到错误 500。

(对于 inf :我将电子表格用于 excel,并且一切正常 localhost 和 serverur。)

PhpWord version is 0.16 with composer
Php 7.3
Localhost : windows.
Serveur: linux with for the directory chmod 0755

当我做一个

echo sys_get_temp_dir() . PHP_EOL; 

我得到:/tmp。

最后一件事,如果我使用

$PHPWord->loadTemplate, 

在服务器上没问题,但是 loadTemplate 没有 cloneBlock 功能。

如果有人可以帮助我,那将非常友好,我已经失去了所有的头发。

蒂埃里

标签: phpword

解决方案


推荐阅读