作者:滨州电信1988_259 | 来源:互联网 | 2018-03-22 14:59
跳至
建立一个Word文件Template.docx
欲替换的值地方${name}
思路:
仿照smarty,
模板文件一定要命名为docx,后缀
前提,先下载开源类PHPWord,PHP开启ZIP拓展
loadTemplate('Template.docx');
$document->setValue('name', 'xeay');
$document->setValue('class', '软件一班');
$document->setValue('No', '1108000xxxx');
$document->setValue('telephone', '1885022xxxx');
$document->setValue('why', 'ACM');
$document->setValue('signname', 'xeay');
$document->save('image.docx');
?>