首页 > 解决方案 > 块的 phpword 库克隆正在本地主机上工作,但不适用于生产

问题描述

我正在尝试使用以下代码通过 PHPWORD 克隆“block_networth”块

require_once "./Classes/PHPWord/vendor/autoload.php";
header('Content-type: text/html; charset=utf-8');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$templateProcessor = new 
PhpOffice\PhpWord\TemplateProcessor('kcc_templates/kcc_crop_template.docx');
$templateProcessor->cloneBlock('block_networth',2, true, true);

模板文件中的块

${block_networth}
${test}    
${/block_networth}

预期结果

test#1
test#2

实际结果

${block_networth}
${test}
${/block_networth}

标签: phpphpword

解决方案


推荐阅读