При использовании такого кода:
require_once 'vendor/autoload.php';
$document = new \PhpOffice\PhpWord\TemplateProcessor('resources/Template.docx');
$document->setValue('FirstName', '777');
$document->saveAs('resources/result.docx');
Вылетает ошибка:
[16-Sep-2020 20:09:44 UTC] PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/vendor/phpoffice/phpword/src/PhpWord/Shared/ZipArchive.php:135
Stack trace:
#0 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/vendor/phpoffice/phpword/src/PhpWord/TemplateProcessor.php(117): PhpOffice\PhpWord\Shared\ZipArchive->open('/tmp/PhpWord57H...')
#1 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/wp-content/themes/zakra/page.php(38): PhpOffice\PhpWord\TemplateProcessor->__construct('/home/tefpklwa2...')
#2 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/wp-includes/template-loader.php(106): include('/home/tefpklwa2...')
#3 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/wp-blog-header.php(19): require_once('/home/tefpklwa2...')
#4 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/index.php(17): require('/home/tefpklwa2...')
#5 {main}
thrown in /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/vendor/phpoffice/phpword/src/PhpWord/Shared/ZipArchive.php on line 135
Если его немного изменить (как пример в документации):
require_once '/home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/vendor/autoload.php';
$templateProcessor = new TemplateProcessor('/home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/vendor/phpoffice/phpword/src/PhpWord/resources/Template.docx');
$templateProcessor->setValue('FirstName', '777');
$templateProcessor->saveAs('/home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/vendor/phpoffice/phpword/src/PhpWord/resources/Result.docx');
Вылетает ошибка:
[16-Sep-2020 22:56:28 UTC] PHP Fatal error: Uncaught Error: Class 'TemplateProcessor' not found in /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/wp-content/themes/zakra/page.php:38
Stack trace:
#0 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/wp-includes/template-loader.php(106): include()
#1 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/wp-blog-header.php(19): require_once('/home/tefpklwa2...')
#2 /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/index.php(17): require('/home/tefpklwa2...')
#3 {main}
thrown in /home/tefpklwa2kwr/public_html/jaxx.dr-weedy.care/wp-content/themes/zakra/page.php on line 38
Как пофиксить?