原文地址:http://www.niu12.com/article/16
php使用phpword将word内容变量替换
a.安装phpword
composer require phpoffice/phpword
b.当前目录下a.docx,假设word内容需要替换的变量为
说明人:${user}电话:${email}
c.php改写word内容
参考地址
<?php// 根据模板生成用户信息word$templateProcessor = new TemplateProcessor("./a.docx");$templateProcessor->setValue(‘user‘, ‘周起‘);$templateProcessor->setValue(‘email‘, ‘445864742@qq.com‘);$templateProcessor->saveAs("./b.docx");
php根据word模板生成新的word文件
原文地址:https://www.cnblogs.com/zhouqi666/p/10340833.html