phpword读取WORD文档,对内容进行标签替换
use PhpOffice\PhpWord\TemplateProcessor;
Vendor("PhpOffice");
$templateProcessor = new TemplateProcessor('./Uploads/Docs/vip.docx');
$templateProcessor->setValue('studentname','sshwwxb');//学生姓名
//保存文件
$filename = time();
$templateProcessor->saveAs('./Uploads/Contract/'.$filename.'.docx');